Microsoft Office Tutorials and References
In Depth Information
Creating Command Buttons
Making other cool buttons
You can run the Command Button Wizard to make lots of other useful
buttons. Command buttons, for example, do some of our favorite things.
Following are a few of the available actions:
✦ Add a new record that’s a duplicate of the current record. Choose the
Record Operations category and the Duplicate Record action.
✦ Save the current record. Choose the Record Operations category and
the Save Record action.
✦ Display the results of a query in Datasheet view. Choose the
Miscellaneous category and the Run Query action. You could display all
the other orders by the same customer or all the recent orders for the
same product, for example.
✦ Run a macro. Choose the Miscellaneous category and the Run Macro
action. (Book VI describes how to make macros that do all kinds of
Customizing your command button
You can change the properties of a command button after you create it. To
do so, display the button’s property sheet by right-clicking the command
button in Design view and choosing Properties from the contextual menu.
The following table lists some of the most useful properties and describes
what they do.
Caption (Format tab)
Text that appears on the button unless it displays
a picture. (If the Picture property specifies a
picture, the button shows the picture, not the
Picture (Format tab)
Picture (icon) that appears on the button. The
term (image) indicates that you selected a
picture. Click the Build button to the right of the
property to select a different picture. If the
picture is blank, Access displays the Caption text.
Program (macro or VBA module) that Access runs
when you click the button.
On Click (Events tab)
You can tell Access to run programs when you click, double-click, move
into, or move away from the button (and at other times, too) by setting the
Events properties of the command button — or almost any other kinds of
controls, for that matter. See Book VI, Chapter 1 for information about how
events work on a form.