PRB: OnExit Macro Runs with AfterUpdate Macro in Option Group

    Article ID: Q109317
    Creation Date: 02-JAN-1994
    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.

    Both the macro in the AfterUpdate property and the macro in the OnExit property of an option group will run when you update the option group, if the macro action in the AfterUpdate property is an ApplyFilter action.

    RESOLUTION

    Do not use a macro in the OnExit property of an option group if the option group's AfterUpdate property runs a macro that contains an ApplyFilter action.

    MORE INFORMATION

    Steps to Reproduce Behavior

    1. Open the sample database Northwind.mdb (or NWIND.MDB in versions 1.x and 2.0).
    2. Create a new form based on the Employees table. Add the EmployeeID and LastName fields to the form.

      NOTE: In versions 1.x and 2.0, there is a space in Employee ID and Last Name.

    3. Create an option group on the form with two toggle buttons and set the following properties:

            Option Group: Test
               AfterUpdate: Macro1
               OnExit: Macro2
            Option Button: Button1
               Option Value: 1
            Option Button: Button2
               Option Value: 2
      
    4. Save the form as Form1.
    5. Create the following two new macros:

            Macro Name   Condition                Action
            -------------------------------------------------
            Macro1       Forms![form1]![test]=1   ApplyFilter
                         Forms![form1]![test]=2   ApplyFilter
            Macro2                                MsgBox
      

            Macro1 Actions
            ---------------------------------------------------------------------
            ApplyFilter
               Where: [EmployeeID]=5 (or [Employee ID]=5 in versions 1.x and 2.0)
            ApplyFilter
               Where: [EmployeeID]=7 (or [Employee ID]=7 in versions 1.x and 2.0)
      

            Macro2 Actions
            ----------------
            MsgBox
               Message: Test
      
    6. Toggle between the two option buttons. Note that both the ApplyFilter and MsgBox actions are run.

    REFERENCES

    For more information about event properties, search the Help Index for "event procedures, event properties," or ask the Microsoft Access 97 Office Assistant.


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: DcmNwd
Additional reference words: 1.00 1.10 2.00 7.00 97 8.00