ACC: Close Action from Function Does Not Trigger OnClose Error

ID: Q89603


The information in this article applies to:


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          : kbusage FmsEvnt 
Version           : 1.0 1.1 2.0
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: March 10, 1999