Add a Command Button That Prints a Report

Previous Topic

Previous Page
Next Topic

Next Page

Command Button tool

Control Wizards tool

If you often print a report after updating your database, you can save time by using the Command Button Wizard to create a button that automates this task. In the database window, on the Forms tab, select Products and then click Design to open the Products form in form design view. If the toolbox isn’t visible, click Control Toolbox (View menu) to display it. Click the Command Button tool, and then click the Control Wizards tool if it isn’t already selected. In the Products form, click where you want to put the command button, and then follow the instructions in the wizard. When the wizard finishes, Microsoft Access displays the command button in form design view.

What other types of buttons can the wizard create?   Use the wizard to create buttons that automatically open other forms, move between records, and add or delete records, among other tasks. For more information, see Add Buttons That Open Forms and Reports.

Program in Visual Basic

When the Command Button Wizard creates a button, it writes a Visual Basic event procedure to carry out the action you want. Suppose you want to see the event procedure for the Print Inventory Report button. Select the button and then click the Properties button to open its property sheet. In the property sheet, select the OnClick property, and then click the Build button. Using the Visual Basic programming language, you can edit or add to the event procedure that the Command Button Wizard creates. Or, write your own event procedures to customize Microsoft Access even further.

Next Steps

To

See


See examples of how to use macros to automate work in forms and reports

The Northwind sample database, which Setup installs with Microsoft Access (if Northwind isn’t already installed, rerun Setup to install it)

Learn more about programming in Visual Basic and creating custom database applications using Microsoft Access

Building Applications with Microsoft Access 97, available directly from Microsoft by using the order form provided with Microsoft Office (also available as part of the ValuPack on the Office 97, Professional Edition CD)