Trying to call a procedure in a subform

  • Thread starter Thread starter SecretAgent
  • Start date Start date
S

SecretAgent

I have been trying to figure out how to do this on my own but I am stumped.

When I use
DoCmd.RunCommand acCmdRecordsGoToNew
or
DoCmd.GoToRecord , , acNewRec
on the main form the subform does not seem to move to a new record. What is
the best way to do this? Thanks for the help!
 
The subform needs to be running that code, not the main form.
DoCmd.RunCommand actions can produce unexpected results, as you're seeing.

Try this code from the main form (replace NameOfSubformControlOnMainForm
with the actual name of the control on the main form that holds the
subform):

Me.NameOfSubformControlOnMainForm.Form.Recordset.AddNew
 
That worked. Thanks for your help!

Ken Snell (MVP) said:
The subform needs to be running that code, not the main form.
DoCmd.RunCommand actions can produce unexpected results, as you're seeing.

Try this code from the main form (replace NameOfSubformControlOnMainForm
with the actual name of the control on the main form that holds the
subform):

Me.NameOfSubformControlOnMainForm.Form.Recordset.AddNew

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/
 
Back
Top