Microsoft Office Tutorials and References
In Depth Information
Creating Command Buttons
Making a Close button
Who needs a Close button when forms already have a big X button in the
top-right corner? Some people like to have a Close button anyway, though,
and it’s easy enough to make. Here’s how:
1. With your form open in Design view, click the Button icon in the
Controls group on the Design tab of the Ribbon.
2. Click the place on the form where you want the button to appear.
Don’t worry about the exact location; you can always move it later.
Access starts the Command Button Wizard, shown in Figure 3-7.
3. Select the Form Operations category and the Close Form action, and
then click Next.
4. Choose whether you’d like to have text or a picture on the button,
specify what text or which picture, and then click Next.
If you choose the Text option, you can edit the text in the box. (Access
suggests Close Form for the text, which sounds pretty good to us.) If
you choose the Picture option, you can choose a suggested icon from a
list or click the Browse button to look at the full set of icons that Access
provides. When you select an icon, it appears on the left side of the
dialog box. You can use any bitmap (.bmp) file as an icon.
5. Type a name for your new control.
The suggested name is something like Command7, so change it to
something meaningful, such as CloseButton.
6. Click Finish.
The wizard creates a command-button control where you originally
clicked the form. Now you can drag the edges of the button to resize it
or drag the whole button to another location.