Activate, Deactivate Events - Event Procedures

Activate, Deactivate Events — Event Procedures

See Also         Example

To create an event procedure that runs when the Activate or Deactivate event occurs, set the OnActivate or OnDeactivate property to [Event Procedure], and click the Build button .

Syntax

Private Sub Form_Activate( )

Private Sub Report_Activate( )

Private Sub Form_Deactivate( )

Private Sub Report_Deactivate( )

Remarks

You can use Activate and Deactivate event procedures to display and hide custom toolbars. If you use a Deactivate event procedure to hide a custom toolbar on a form, also make sure to hide the toolbar in response to the Unload event for the form, because the Deactivate event doesn't occur when a form is unloaded. Don't use the GotFocus or LostFocus event to display or hide a toolbar on a form, because these events aren't triggered on forms that contain enabled controls.

You can't cancel the Activate or Deactivate event.