Microsoft Office Tutorials and References
In Depth Information
Creating Command Buttons
Figure 3-8:
The
Command
Button
Wizard
asks which
fields to
use to find
a matching
record.
8. Type a name for the control.
How about using OpenAddressBookForm for the control name? We
don’t mind using long names when they provide clarity.
9. Click Finish.
The wizard makes the command button.
10. Switch to Form view (by clicking the View button on the toolbar) to
try out your new button!
When you click the button, Access opens the new form in a separate tab
(or in a separate window, if you’ve configured Access to use multiple
windows).
Making a button to print the current record
The Command Button Wizard offers several print actions, but most of them
don’t work the way you may want them to. The Print a Form action prints a
form once for every single record in the form’s record source, for example,
so you need to come up with a way to restrict the records to the one(s) you
want. If you want to print the current record in the current form, run the
Command Button Wizard, and select the Record Operations category and
the Print Record action. These categories and actions are among those you
can choose, as shown in Figure 3-8, earlier in this chapter.
If you want to print a report — rather than the current form — for just the
current record, you need to do some extra work. Specifically, you need to
create a macro or VBA module that the button runs, and you need to set
up the macro or VBA to print the report with the records limited to those
records that match the record currently displayed on the form.
Luckily, this macro is short and easy to make. See Book VI, Chapter 1 for
specific directions.
Search JabSto ::




Custom Search