Access DoCmd CancelEvent Method Example
The Cancel Event action method cancels the event that caused Microsoft Access to run the code containing this action
The CancelEvent method has no arguments and can be called directly using the syntax DoCmd.CancelEvent.This Access method has an effect only when it’s run as the result of an event. This method cancels the event.
All events that can be canceled in Visual Basic have a Cancel argument. You can use this argument instead of the cancel event method to cancel the event. The KeyPress event and MouseDown event (for right-clicking only) can be canceled only in macros, not event procedures, so you must use the cancelevent action in a macro to cancel these events.
Below is a summary table showing which events can be cancelled using the cancel event method.
ApplyFilter
Dirty
MouseDown
BeforeDelConfirm
Exit
NoData
BeforeInsert
Filter
Open
BeforeUpdate
Format
DblClick
KeyPress
Unload
Delete
Microsoft Office VBA, MS Access 2003, 2007, 2010, 2013, 2016