PRB: Setting OnEnter to TAB and OnExit to SHIFT+TAB Loops

    Article ID: Q105977
    Creation Date: 28-OCT-1993
    Revision Date: 01-DEC-1996

    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.

    If you set the OnEnter property of text box on a form to run a macro that sends a TAB, and you set the OnExit property of the text box to run a macro that sends a SHIFT+TAB, an infinite loop occurs when you view the form in Form view.

    CAUSE

    When you view the form in Form view, the text box control's OnEnter property runs a macro that sends a TAB. The TAB triggers the control's OnExit property, which runs a macro that sends a SHIFT+TAB. The SHIFT+TAB triggers the OnEnter property again, and so on.

    RESOLUTION

    The macros are performing as they should. Press CTRL+BREAK to cause the macros to stop running.

    MORE INFORMATION

    Steps to Reproduce Behavior

    1. Create the following macros:

            Macro Name       Action
            -------------------------
            Tab              SendKeys
            ShiftTab         SendKeys
      

            Tab Actions
            --------------------
            SendKeys
               Keystrokes: {tab}
               Wait: No
      

            ShiftTab Actions
            ---------------------
            SendKeys
               Keystrokes: +{tab}
               Wait: No
      
    2. Create a new form. Add two text boxes to the form.
    3. Set the first text box's OnEnter property to Tab, and its OnExit property to ShiftTab.
    4. View the form in Form view. Note that an infinite loop occurs.


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.
©1997 Microsoft Corporation. All rights reserved. Legal Notices.

KBCategory: kbusage
KBSubcategory: FmsEvnt
Additional reference words: 1.00 1.10 2.00 7.00 97 8.00 on enter exit