Command Button Control.
You can use the Default property to specify whether a command button on a form has the focus.
The Default property uses the following settings.
Setting | Description | Visual Basic |
Yes | The command button is the default button. | True (-1) |
No | (Default) The command button isnt the default button. | False (0) |
You can set this property using the command buttons property sheet, a macro, or Visual Basic.
When the command buttons Default property setting is Yes and the form is in the active window, the user can choose the command button by pressing ENTER (if no other command button has the focus) or by clicking on it.
Only one command button on a form can be the default button. When the Default property is set to Yes for one command button, it is automatically set to No for all other command buttons on the form.
Tip For a form that supports irreversible operations, such as deletions, its a good idea to make the Cancel button the default command button. To do this, set both the Default property and the Cancel property to Yes.
Cancel Property.