gotorecord for a subform?

G

Guest

What is the syntax for using gotorecord for a subform. If I use if for the
root form all is well, but for a subform the error message says that the form
is not open (I am assuming that it can't see it).
for example:
docmd.GoToRecord acDataForm,"subform",acNext

I assume that the problem is that I cannot just give the subform name, so
how do I identify it?

thanks,
 
V

Van T. Dinh

Are you running the code in the context of the Main Form, e.g. the code in a
CommandButton on the Main Form?

If that is the case, try:

Me.SubformCONTROLName.SetFocus
DoCmd.GoToRecord , , acNext

You need to check the SubformCONTROLName in the DesignView of the Main Form
since it may be different from the name of the Form being used as the
Subform.
 

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