ACC2000: GoToControl to Control with Focus in AfterUpdate IgnoredID: Q208178
|
You you try to use the GoToControl method or the SetFocus method in the AfterUpdate event of a control to set focus back the control that is being updated, the GoToControl or SetFocus method will be ignored. For example, the following code, will not cause the control named MyControl to retain focus once it is updated:
Private Sub MyControl_AfterUpdate()
DoCmd.GoToControl "MyControl"
End Sub
You will see the same behavior when you use the GoToControl action in a Macro.
You cannot set the focus on a form to an object that already has focus.
You can get the desired results in one of the following ways:
Private Sub MyControl_OnExit(Cancel As Integer)
Cancel = True
End Sub
When you add this code to a control, the only way to move to a different control on the form is by using the pointer.
Macro Name Condition Action
------------------------------------------
Test1 ([City]="aaaa") GoToControl
Test1 Actions
-------------
GoToControl
Control Name: [City]
For more information about the GoToControl action, click Microsoft Access Help on the
Help menu, type "GoToControl" in the Office Assistant or the Answer Wizard,
and then click Search to view the topics returned.
For more information about the GoToControl method, in the Visual Basic Editor, click
Microsoft Visual Basic Help on the Help menu, type "GoToControl method" in
the Office Assistant or the Answer Wizard, and then click Search to
view the topic.
Additional query words: prb
Keywords : kbusage kbdta McrActn
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: May 13, 1999