UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Goto New Record On Subform., Access 2003    
 
   
zocker
post Jan 24 2020, 05:20 AM
Post#1


Utterly Eccentric and Moderator
Posts: 4,094
Joined: 4-March 00
From: Bristol / Ipswich / Spain/Gloucester


Greetings All! Its good to see the ship afloat and busy-today with over 1000 visitors in this hour!

Without success, I am attempting to make a subform goto a New record. This is the setup: (A2003 on Win 7)
I have a main form frmAccounts with subform subTransactions. On frmAccounts there is a combo cboFind that makes it Goto a particular account, the sub is synchronised and shows relevant Transactions for the mainform's accounts. Because there are now many entries for Transactions, the new record is off the page and has to be scrolled....so I want to go directly to a New Record.
I use Docmd.GotoRecord,,acNewRec on the OnCurrent event of the subform which works correctly when the main form opens qnd on subsequent choices chosen from cboFind.
BUT of course OnCurrent fires when attempting to edit or view another record, causing it to move to (of course) the New record, thus making the records ineditable....so any ideas anyone? I have tried with various other events with no success.

Many thanks

Zocker

--------------------
I think they're for 1 am. Rene Descartes
Go to the top of the page
 
missinglinq
post Jan 24 2020, 06:39 AM
Post#2



Posts: 4,665
Joined: 11-November 02



Can't test this, now, but I think given your needs you're going to have to use a Command Button on your main form to do this...something along the line of

SubFormControlName.SetFocus
DoCmd.GoToRecord , , acNewRec


Note that SubFormControlName is the name of the Subform Control...which may or may not be the same as the name of the Form the Subform is based on.

Linq ;0)>

--------------------
BTW...The Monkey is laughing at me...not at any other poster!

The problem with making anything foolproof...is that fools are so darn ingenious!

All posts/responses based on Access 2003/2007
Go to the top of the page
 
msbad1959
post Jan 24 2020, 06:39 AM
Post#3



Posts: 21
Joined: 5-June 18



Put this right above your docmd

forms!mainformname!subformname.setfocus
Go to the top of the page
 
BruceM
post Jan 24 2020, 07:25 AM
Post#4


UtterAccess VIP
Posts: 8,028
Joined: 24-May 10
From: Downeast Maine


Another option would be something like:

Me.SubformControlName.Form.Recordset.AddNew
Go to the top of the page
 
projecttoday
post Jan 24 2020, 08:01 AM
Post#5


UtterAccess VIP
Posts: 11,604
Joined: 10-February 04
From: South Charleston, WV


SubFormControlName.SetFocus
DoCmd.GoToRecord , , acNewRec


Couldn't you put this in the on current event of the main form?



--------------------
Robert Crouser
Go to the top of the page
 
zocker
post Jan 24 2020, 08:16 AM
Post#6


Utterly Eccentric and Moderator
Posts: 4,094
Joined: 4-March 00
From: Bristol / Ipswich / Spain/Gloucester


Thanks for your quick replies! I have been kicking this around now for so long I can't see it any more. I have zipped a copy with few sample records to here, please could someone have a look? Thanks, I need to choose an account (Accounts Form, FINDAcc) and have the subform go to a new record, every time FINDAcc is used.
Much appreciated,

Zocker
Attached File(s)
Attached File  HouseHold___Copy.zip ( 121.15K )Number of downloads: 4
 

--------------------
I think they're for 1 am. Rene Descartes
Go to the top of the page
 
projecttoday
post Jan 24 2020, 08:32 AM
Post#7


UtterAccess VIP
Posts: 11,604
Joined: 10-February 04
From: South Charleston, WV


Remove Docmd.Gotorecord from the subform.

In the main form in the after update event of findac, un-comment out docmd.gotorecord and put this:

CODE
Me.Transactions.SetFocus


before it.

--------------------
Robert Crouser
Go to the top of the page
 
BruceM
post Jan 24 2020, 08:41 AM
Post#8


UtterAccess VIP
Posts: 8,028
Joined: 24-May 10
From: Downeast Maine


How about this (the AddNew option, with no subform code)?
Attached File(s)
Attached File  HouseHold___Copy_V2.zip ( 46.35K )Number of downloads: 4
 
Go to the top of the page
 
zocker
post Jan 24 2020, 10:46 AM
Post#9


Utterly Eccentric and Moderator
Posts: 4,094
Joined: 4-March 00
From: Bristol / Ipswich / Spain/Gloucester


Thanks so much ProjectT and Bruce, both solutions work perfectly!
Thanks again!




--------------------
I think they're for 1 am. Rene Descartes
Go to the top of the page
 
projecttoday
post Jan 24 2020, 11:51 AM
Post#10


UtterAccess VIP
Posts: 11,604
Joined: 10-February 04
From: South Charleston, WV


You're welcome.

--------------------
Robert Crouser
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    24th February 2020 - 02:34 AM