Report.Unload Event

Access Developer Reference

The Unload event occurs after a report is closed but before it's removed from the screen.

Version Information
 Version Added:  Access 2007

Syntax

expression.Unload(Cancel, )

expression   A variable that represents a Report object.

Parameters

Name Required/Optional Data Type Description
Cancel Required Integer

Remarks

To run a macro or event procedure when these events occur, set the OnUnload property to the name of the macro or to [Event Procedure].

The Unload event is caused by user actions such as:

  • Closing the report.
  • Running the Close action in a macro.
  • Quitting an application by right-clicking the application's taskbar button and then clicking Close.
  • Quitting Windows while an application is running.

By running a macro or an event procedure when a report's Unload event occurs, you can verify that the report should be unloaded or specify actions that should take place when the report is unloaded. You can also open another report or display a dialog box requesting the user's name to make a log entry indicating who used the report.

When you close a report, the following events occur in this order:

Unload → Deactivate → Close

The Unload event occurs before the Close event. The Unload event can be canceled, but the Close event cannot.

Bb215157.vs_note(en-us,office.12).gif  Note
When you create macros or event procedures for events related to the Unload event, such as Deactivate and LostFocus, be sure that they don't conflict (for example, make sure you don't cause something to happen in one macro or procedure that is canceled in another) and that they don't cause cascading events.