How to Write a Macro to Print on a Button Click in Access 2007

How to Write a Macro to Print on a Button Click in Access 2007 thumbnail
Create a button on a form that will print just by clicking on it.

Macros are used in Microsoft Access 2007 to automate repetitive tasks. The Visual Basic for Applications programming shell can create macros, but instead of recording actions, it runs a series of programming code. Access 2007 has a Macro Builder for the novice user to quickly create macros. When creating forms in Access 2007, add items such as buttons that can carry out the tasks created with macros. You can add a macro to a button that will print out a document every time a user clicks on it.

Instructions

    • 1

      Open the database in Microsoft Access. Double-click on the database in its containing folder location or click on the "Office" button, then "Open" in Access.

    • 2

      Click on the "Navigation Pane" on the left side of the screen to open it and see a list of database objects.

    • 3

      Right-click on the form's name in the "Navigation Pane," then click on "Design View." The "Form Design Tools" group of tabs show in the "Ribbon."

    • 4

      Click on the "Command Button" icon in the "Controls" group of the "Design" tab. Click and drag the mouse button to draw the command button on the form. Click "Cancel" when the dialog box appears. See the command button on the form.

    • 5

      Double-click the command button and type in "Print." Click anywhere on the form to deselect the button so that the caption remains.

    • 6

      Click on the button again to select it. Right-click on it, then click on "Build Event." Choose "Macro Builder" from the list in the dialog box.

    • 7

      Click on the down-arrow next to "Add New Action," then select "Print Object." Click on "Save" in the Macro Builder and then "Close." Click on the "Form View" button in the "Views" group on the "Ribbon." Click on the "Print" button you just added to test out the macro.

Related Searches:

References

  • Photo Credit Thomas Northcut/Photodisc/Getty Images

Comments

Related Ads

Featured