Cancel

This property returns and sets a value indicating whether a command button is the Cancel button on a form. This command button can be the CommandButton control.

Syntax

button.Cancel [= Boolean]

Parameters

button
Object expression that evaluates to an CommandButton.
Boolean
Boolean expression that specifies whether the object is the Cancel button.

Remarks

Only one CommandButton control on a form can be the Cancel button. When the Cancel property is set to True for one CommandButton, it automatically is set to False for all other CommandButton controls on the form. When a CommandButton control's Cancel property setting is True and the form is the active form, a user can choose the CommandButton by clicking it, pressing the ESC key, or pressing ENTER when the button has the focus.