Cancel the event that caused Microsoft Access to run the procedure containing this method.
In forms, the CancelEvent action is often used in a validation macro with the BeforeUpdate event property. When a user enters data in a control or record, Access runs the macro before saving the data to the database. If the data fails the validation conditions in the macro, the CancelEvent action cancels the save.
All events that can be canceled in Visual Basic have a Cancel argument. You can use this argument instead of the CancelEvent 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.
For events that can't be canceled, the default behavior occurs before the procedure runs.
Double-clicking a word that the insertion point is on in a text box, Access normally selects the word. You can cancel this default behavior in the procedure for the DblClick event and perform some other action, such as opening a form.
“A bad beginning makes a bad ending” ~ Euripides
DoEvents - Allow the operating system to process other events.
OnClick, OnOpen - Events.