MS Access Macro – How To Open a Report

An MS Access macro is a great tool for automating our databases. We can use Microsoft Access macro actions for many tasks.

In this demonstration I am going to open a report by using a macro.

The MS Access macro designer has three main columns
1. Macro Name
2. Action
3. Comment

Enter the name of the new MS Access macro in the ‘Macro Name’ column.
Now move to the ‘Action’ column and select the ‘OpenReport’ action.
Look towards the bottom of the screen and you will see the action arguments section. Enter the name of the report in the report name section. In the view section select the view you wish to see the report in. In this example I want to see it in print preview mode.

Now save the MS Access macro and close the designer window.

Create a brand new form in design view.
Now make sure the wizard button is clicked as you want to use a wizard for the next step.
From the toolbox control area you want to click the command button control.
Drop the button onto the form.
The wizard will now load and you will see two columns – categories and actions.
Select from the categories box the option called miscellaneous.
From the actions box select the run macro action.
Click the ‘Next’ button and on the next screen select the macro that you saved earlier.
Click the ‘Next’ button and on the next screen add text to the button.
Click the finish button.

Now run the form and click your command button.
The Microsoft Access macro will run and your report will open in print preview mode.

The MS Access macro makes our life so much easier. We don’t need to learn complex programming code to add power to the database.

To further your learning of the MS Access macro check out this great new MS Access macro ebook.

Tags: , , ,