Trying to call a procedure in a subform

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!
 
K

Ken Snell \(MVP\)

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
 
S

SecretAgent

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top