Microsoft KB Archive/198460

= ACC2000: In a Report, Close Event Occurs Before Deactivate Event =

Article ID: 198460

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q198460



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



SUMMARY
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
 Open the sample database Northwind.mdb. Open the Employees form in Design view.  Set the form's OnDeactivate property to the following event procedure: Private Sub Form_Deactivate MsgBox "Deactivate event" End Sub   Set the form's OnClose property to the following event procedure: Private Sub Form_Close MsgBox "Close event" End Sub  Save and close the form. Open the Employee form in Form view.</li> Close the form.

Note that the Deactivate message appears before the Close message.</li></ol>

Steps to See this Behavior in a Report
<ol> Open the sample database Northwind.mdb.</li> Open the Customer Labels report in Design View.</li>  Set the report's OnDeactivate property to the following event procedure: Private Sub Report_Deactivate MsgBox "Deactivate event" End Sub </li>  Set the report's OnClose property to the following event procedure: Private Sub Report_Close MsgBox "Close event" End Sub </li> Save and close the report.</li> Open the Customer Labels report in Print Preview view.</li> Close the report.

Note that the Close message appears before the Deactivate message.</li></ol>

<div class="references_section">