Microsoft Access VBA Macro Programming

(Tina Sui) #1
Other Controls

Many other controls can be used on a form, but the following are the main ones.

Button
The Command button control is very useful for directing the user to take a particular action.
You may want to use the form as an opening form of options using command buttons, or you
may want to allow the user to open another form on top of the existing one.
If you have disabled the Close button, you will need to place a Command button with an
Exit command on the form. This could be because you wish to make certain updates before
the user exits the form, and if they clicked the Close button they would circumvent your code.
To add a button to a form, you need to be in the form’s Design view. Click the Design tab
on the ribbon and drag the button icon onto the form. This will take you into the Command
Button Wizard, as shown in Figure 9-6.
If you do not want to use the wizard to set up your button, click Cancel and you can
change the properties, such as Caption, manually. However, the wizard does provide buttons

108 Microsoft Access 2010 VBA Macro Programming


Figure 9-6 The Command Button Wizard
Free download pdf