ACC: GoToControl to Control with Focus in AfterUpdate Ignored

Last reviewed: May 27, 1997
Article ID: Q90806
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

When a control has the focus and the GoToControl action is carried out with the same control name that has the focus, the focus will move to the next control in the tab order. The focus will not stay on the control that currently has the focus, as you would expect.

RESOLUTION

To prevent the focus from leaving the field, you can use an OnExit macro that performs the CancelEvent action. Or, if you want to prevent the field from being saved (and also prevent the focus from leaving the control), you can use a validation rule or a BeforeUpdate macro.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. In the sample database Northwind.mdb (or NWIND.MDB in versions 1.x and 2.0), create the following macro named Test1:

       Macro Name   Condition         Action
       ------------------------------------------
       Test1        ([City]="aaaa")   GoToControl
    
       Test1 Actions
       -------------
       GoToControl
         Control Name: [City]
    
    

  2. Open the Customers form in Design view. Set the City control's AfterUpdate property to the Test1 macro.

  3. View the Customers form in Form View.

  4. Type "aaaa" in the City field and press TAB. Note that the focus moves to the next field in the tab order. However, if you had moved to another control before pressing TAB, the focus would not have changed.

REFERENCES

For more information about GoToControl, search the Help Index for

"GoToControl action," or ask the Microsoft Access 97 Office Assistant.


Keywords : kbusage McrActn
Version : 1.0 1.10 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 27, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.