ACC: Close Action from Function Does Not Trigger OnClose Error (89603)



The information in this article applies to:

  • Microsoft Access 1.0
  • Microsoft Access 1.1
  • Microsoft Access 2.0

This article was previously published under Q89603
Moderate: Requires basic macro, coding, and interoperability skills.

SYMPTOMS

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.

Modification Type:MajorLast Reviewed:5/9/2003
Keywords:kbprb kbusage KB89603