Cancel Property

See Also1DPW1U2

Applies To

Command buttonXJSPC0.


Determines whether a command button is the Cancel button on a form.


[form.]commandbutton.Cancel[ = boolean ]


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.



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 focus1L3L8ZY.


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 Default31OHP7N property to True.


Data Type

IntegerDOKXHY (Boolean)

See Also


CancelError Property1LPJA9H

Default Property31OHP7N

KeyDown, KeyUp EventsRI06O6

KeyPress EventPFFDUA


Programmer's Guide:

Chapter 3, "Creating and Using Controls"