The GoToControl macro action does not allow you to use the full syntax for
the
ControlName argument as:
Forms![orders]![orders subform]![ProductID]
If you use this syntax, you may receive the following error message:
There is no field named 'Forms![Orders]![Orders subform]![ProductID]' in the current record.
To work around this behavior, you need to set up a macro that first sets
the focus to the subform control, and then sets the focus to a specific
control on the subform.
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.
- Open the sample database Northwind.mdb.
- Create the following new macro called GoToSubform:
Macro Name Macro Actions
-----------------------------
GoToSubform GoToControl
GoToControl
GoToSubform Actions
-------------------------------
GoToControl
Control Name: Orders Subform
GoToControl
Control Name: ProductID
- Open the Orders form in Design view.
- Add a command button to the form and set the following properties:
Caption: Enter/Modify Orders
OnClick: GoToSubform
- Open the Orders form in Form view. Click the Enter/Modify Orders button. Note that the insertion point moves to the Product field on the Orders subform.