Activate, Deactivate Events -- Macros

Description

To run a macro when the Activate or Deactivate event occurs, set the OnActivate or OnDeactivate property to the name of the macro.

Remarks

You can use the ShowToolbar action in an Activate or Deactivate macro to display or hide a custom toolbar. Use the Activate or Deactivate event to display or hide custom toolbars when you have more than one form loaded at a time. If you have only one form loaded at a time, you can use the Open and Close events.

If you use a Deactivate macro to hide a custom toolbar, also make sure to hide the toolbar in response to the Unload event for the form or report, because the Deactivate event doesn’t occur when a form or report is unloaded. Don’t use the GotFocus or LostFocus event to hide a custom toolbar, because these events aren’t triggered on forms or reports that contain enabled controls.

You can’t use the CancelEvent action in an Activate or Deactivate macro.

See Also

Activate, Deactivate Events — Event Procedures.