VBA to move to a new record in a subform

andy1968

Registered User.
Local time
Today, 13:55
Joined
May 9, 2018
Messages
131
I have code in my form to print preview a report.


I would like to move to a new record in a subform after the report is opened.


I have tried to enter this code at the end of the open report code:


Code:
Me.frmToDoListEntryLinks.SetFocus
DoCmd.GoToRecord , , acNewRec


I get a Run-time error '2046': The command or action 'GoToRecord' isn't available now.




The focus moves to the subform, but that stops on the last record.
 
on your form:

docmd.openreport "the report"
docmd.gotorecord,, acNewRec
 
Wouldn't that just move to a new record on the main form?


I'm trying to move to a new record on a subform.
 
'2x
Me.subformname.setfocus
Me.subformname.setfocus
docmd.gotorecord,, acNewRec
 
Hi. Since we can't see your subform, I'm just gonna ask: Does your subform allow additions?
 
Yes, it does.


I tested the code on as a stand alone on the main form and it worked flawlessly.
 
Me.frmToDoListEntryLinks.Form.Recordset.AddNew
 

Users who are viewing this thread

Back
Top Bottom