To create an event procedure that runs when the BeforeUpdate or AfterUpdate event occurs, set the BeforeUpdate or AfterUpdate property to [Event Procedure], and click the Build button .
Syntax
Private Sub Form_BeforeUpdate(Cancel As Integer)
Private Sub controlname_BeforeUpdate(Cancel As Integer)
Private Sub Form_AfterUpdate( )
Private Sub controlname_AfterUpdate( )
The BeforeUpdate event procedure has the following arguments.
Argument | Description |
---|---|
controlname | The name of the control whose BeforeUpdate event procedure you want to run. |
Cancel | The setting determines if the BeforeUpdate event occurs. Setting the Cancel argument to True (–1) cancels the BeforeUpdate event. |
The AfterUpdate event procedure has the following argument.
Argument | Description |
---|---|
controlname | The name of the control whose AfterUpdate event procedure you want to run. |
Remarks
You can't cancel the AfterUpdate event.
You can use an AfterUpdate event procedure to display a different page in the form or move the focus to a particular control or record. For example, when the user enters a value in a Category control on a form, you can use the GoToPage method in the AfterUpdate event procedure for the form to move the focus to the page of the form that contains the controls for that category.