Make a command button the default button in a form or custom dialog box

Make a command button the default button in a form or custom dialog box

  1. Open a form in Design view.

  2. Click the command button, and then click Properties on the toolbar to open the command button's property sheet.

  3. In the Default property box, click Yes.

When a command button's Default property is set to Yes and the form is the active form, you can choose the command button by clicking it or by pressing ENTER when no other command button has the focus. When the Default property is set to Yes for one command button, it's automatically set to No for all other command buttons on the form. Only one button can be the default on a form.

Tip   For a form that allows irreversible operations, such as deletions, it's a good idea to make the Cancel button the default command button. To do this, set both the Cancel property and the Default property to Yes.