ACC: In a Report, Close Event Occurs Before Deactivate Event

Last reviewed: September 11, 1997
Article ID: Q173684
The information in this article applies to:
  • Microsoft Access versions 2.0, 7.0, 97

SUMMARY

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

The sequence of the Deactivate and Close events for a Microsoft Access form are the reverse of the Close and Deactivate events in a Microsoft Access report.

MORE INFORMATION

When you close a form, the following sequence of events occurs for the form:

   Unload => Deactivate => Close

When you close a report from Print Preview view or when the report closes automatically after the Print event has occurred, the following sequence of events occurs for the report:

   Close => Deactivate

Note that a form's Close and Deactivate events are the reverse of the Deactivate and Close events of a report.

Steps to See this Behavior in a Form

  1. Open the sample database Northwind.mdb (or NWIND.MDB in Microsoft Access 2.0).

  2. Open the Employees form in Design view.

  3. Set the form's OnDeactivate property to the following event procedure:

          Private Sub Form_Deactivate()
    
            MsgBox "Deactivate event"
          End Sub
    
    

  4. Set the form's OnClose property to the following event procedure:

          Private Sub Form_Close()
    
             MsgBox "Close event"
          End Sub
    
    

  5. Save and close the form.

  6. Open the Employee form in Form view.

  7. Close the form.

    Note that the Deactivate message appears before the Close message.

Steps to See this Behavior in a Report

  1. Open the sample database Northwind.mdb (or NWIND.MDB in Microsoft Access 2.0).

  2. Open the Customer Labels report in Design View.

  3. Set the report's OnDeactivate property to the following event procedure:

          Private Sub Report_Deactivate()
    
            MsgBox "Deactivate event"
          End Sub
    
    

  4. Set the report's OnClose property to the following event procedure:

          Private Sub Report_Close()
    
             MsgBox "Close event"
          End Sub
    
    

  5. Save and close the report.

  6. Open the Customer Labels report in Print Preview view.

  7. Close the report.

    Note that the Close message appears before the Deactivate message.

REFERENCES

To find more information about events and their sequence, search the Help Index for "sequence of events", or ask the Microsoft Access 97 Office Assistant.


Additional query words: inf 95 8.00
Keywords : FmsEvnt RptEvent
Version : WINDOWS:2.0,7.0,97
Platform : WINDOWS
Hardware : x86
Issue type : kbinfo
Solution 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: September 11, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.