GoToControl Method [Access 2003 VBA Language Reference]
The GoToControl method carries out the GoToControl Action action in Visual Basic.
expression Required. An expression that returns one of the objects in the Applies To list.
ControlName Required Variant. A string expression that's the name of a control on the active form or datasheet.
For more information on how the action and its argument work, see the action topic.
Use only the name of the control for the controlname argument, not the full syntax.
You can also use a variable declared as a Control data type for this argument.
Dim ctl As Control Set ctl = Forms!Form1!Field3 DoCmd.GoToControl ctl.Name
You can also use the SetFocus method to move the focus to a control on a form or any of its subforms, or to a field in an open table, query, or form datasheet. This is the preferred method for moving the focus in Visual Basic, especially to controls on subforms and nested subforms, because you can use the full syntax to specify the control you want to move to.
The following example uses the GoToControl method to move the focus to the EmployeeID field:
Applies to | DoCmd Object