PRA: Toggle Button's OnKey Events Do Not Run

    Article ID: Q128116
    Creation Date: 27-MAR-1995
    Revision Date: 19-SEP-1996

    The information in this article applies to:

    • Microsoft Access version 2.0

    SYMPTOMS

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

    When a toggle button has the focus and you press a key, the macro or Access Basic code specified for the toggle button's OnKeyPress, OnKeyDown, or OnKeyUp property does not run.

    CAUSE

    This problem occurs when a toggle button is located on a subform of a main form.

    RESOLUTION

    Replace the toggle button with another control such as a command button, a check box, or an option button.

    STATUS

    Microsoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access for Windows 95 version 7.0.

    MORE INFORMATION

    Steps To Reproduce Problem

    1. Open the sample database NWIND.MDB.
    2. Create a new blank form and then add an option group to the form.
    3. Add a toggle button to the option group.
    4. Set the toggle button's OnKeyPress property to the following macro:

            Macro Name  Action
            ------------------
            Test        Msgbox
      

            Test Actions
            -----------------------------------
            Msgbox
               Message: Toggle button macro ran
      
    5. View the form in Form view and choose the toggle button.
    6. Press any key on the keyboard. The message "Toggle button macro ran" appears. Choose the OK button, and then save the form as Form1 and close it.
    7. Create a new form called Form2. Drag the Form1 form from the Database window to Form2. This causes Form1 to become a subform of Form2.
    8. View Form2 in Form view, choose the toggle button on the subform, and then press any key on the keyboard. Note that the message does not appear.

    REFERENCES

    For more information about the OnKeyPress property, search for "OnKeyPress," and then "OnKeyPress Property" using the Microsoft Access Help menu.

    For more information about the OnKeyDown or OnKeyUp property, search for "OnKeyDown," and then "OnKeyDown, OnKeyUp Properties" using the Microsoft Access Help menu.


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.

Additional reference words: 2.00
KBCategory: kbusage
KBSubcategory: FmsOpt