By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,471 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

Jump from a Form to a control (filed) in a SubForm

P: n/a
Dear reader,

How can I jump from a field in the master Form to a field in the sub Form.

I have tread

DoCmd.GoToControl (Forms!MasterFormName!SubFormName!Form.FieldName)

But it doesn't work.

Thanks for any help to fix this.

Kind regards,

Simon van Beek
Jan 17 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Simon:

In my experience, you first must go to the subform control, then to the
field within that control.

Try this, instead:
DoCmd.GoToControl "SubFormName"
DoCmd.GoToControl "FieldName"

The GoToControl action has an inherent reference to the current active
form, which is why you cannot reference outside of the active form's
control collection. For more details, search the VB help file for
GoToControl Action. From the Access 97 VB help file:
"Tip: You can use the GoToControl action to move to a subform, which is
a type of control. <snip> You can also move to a control on a subform
by using the GoToControl action to move first to the subform and then
to the control on the subform."

If you are not starting your jump from the MasterForm (i.e., your
active form is a form other than the MasterForm), you'll need to first
set the focus to the subform control on the MasterForm, and THEN go to
the desired control, like this:

Forms!MasterFormName!SubformName.SetFocus
DoCmd.GoToControl "FieldName"

HTH,
Jana

Jan 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.