Resize Event — Event Procedures

Description

To create an event procedure that runs when the Resize event occurs, set the OnResize property to [Event Procedure], and click the Build button.

Syntax

Private Sub Form_Resize( )

Remarks

To repaint the screen every time a form is resized, use the Repaint method in a Resize event procedure.

You can't cancel the Resize event.

See Also   Resize event — macros.

Example

The following example shows how a Resize event procedure can be used to repaint a form when it is maximized. When the user clicks a command button labeled "Maximize," the form is maximized and the Resize event is triggered.

To try the example, add the following event procedures to a form named Contacts that contains a command button named Maximize:

Private Sub Maximize_Click()
    DoCmd.Maximize
End Sub

Private Sub Form_Resize()
    Forms!Contacts.Repaint
End Sub