See Also
Applies To
Command button.
Description
Determines whether a command button is the Cancel button on a form.
Usage
[form.]commandbutton.Cancel[ = boolean ]
Setting
The Cancel property settings are:
Setting Description
True The command button is the Cancel button.
False (Default) The command button isn't the Cancel button.
Remarks
Use the Cancel property to give a user the option of canceling uncommitted changes and returning the form to its previous state.
Only one command button on a form can be the Cancel button. When the Cancel property is set to True for one command button, it is automatically set to False for all other command buttons on the form. When a command button's Cancel property is True and the form is the active form, the user can choose the command button by clicking it, pressing the Esc key, or pressing Enter when the button has the focus .
Tip For a form that supports irreversible operations, such as deletions, it's a good idea to make the Cancel button the default button. To do this, set both the Cancel property and the Default property to True.
Data Type
Integer (Boolean)
Help:
CancelError Property
Default Property
KeyDown, KeyUp Events
KeyPress Event
Programmer's Guide:
Chapter 3, "Creating and Using Controls"