To create an event procedure that runs when the Dirty event occurs, set the OnDirty property to [Event Procedure], and click the Build button
.
Syntax
Private Sub Form_Dirty(Cancel As Integer )
The Dirty event procedure has the following argument.
| Argument | Description |
|---|---|
| Cancel | The setting determines if the Dirty event occurs. Setting the Cancel argument to True (-1) cancels the Dirty event. You can also use the CancelEvent method of the DoCmd object to cancel the event. |
Remarks
Canceling the Dirty event will cause the changes to the current record to be rolled back. It is equivalent to pressing the Esc key.