ACC: Close Action from Function Does Not Trigger OnClose Error

Last reviewed: May 28, 1997
Article ID: Q89603
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0

SYMPTOMS

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

If a form's OnClose property points to a nonexistent Access Basic function, no error message is generated when you exit the form with a Close action called from an Access Basic function.

RESOLUTION

Close the form with a Close action called from a macro rather than with a Close action called from a function.

STATUS

This behavior no longer occurs in Microsoft Access version 7.0.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Type the following sample function CloseMe()in a new module and save it as Module1:

          Function CloseMe()
    
             DoCmd Close
          End Function
    
    

  2. Create a new form and set the form's OnClose property as follows:

          =Bogus()
    

  3. Add a command button to the form and set the command button's OnClick property as follows:

          =CloseMe()
    

    NOTE: In Microsoft Access version 1.x, the OnClick property is called the OnPush property.

  4. View the form in Form view.

  5. From the File menu, choose Close. Note that you do not receive an error message.

  6. Open the form in Form view again. Click the command button to close the form. Note that you do not receive an error message even though the same nonexistent function is called.


Keywords : FmsEvnt kbusage
Version : 1.0 1.1 2.0
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 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.