VBA & Macro Problems

Use Microsoft Access VBA to Open and Print a Report

Camila MilosovichCamila Milosovich Nov 25, 2026 868 views

Question details

Open and print an Access report from a form button using VBA.

Use Microsoft Access VBA to Open and Print a Report
Product
Microsoft Access
Device & OS
not provided
Scenario
A report uses a select query as its record source, and the user wants to open it from a form.
Observed behavior
Opening the report runs its record-source query, so the query does not need to be executed separately.
Before you start

Confirm that the report's Record Source property points to the intended select query and that the report name matches the name used in your VBA code. If the query refers to form controls, make sure the form is open and the required values are available.

Solution 1Recommended

Open the report from a form button with VBA

Use the button's Click event to preview the report or send it directly to the printer.

1
Open the button's event

Open the form in Design View, select the button, and open its Property Sheet. On the Event tab, set On Click to [Event Procedure] and select the ellipsis button to open the VBA editor.

2
Add the preview command

Inside the button's Click procedure, add: DoCmd.OpenReport "131_Fitness_Rpt", acViewPreview. Replace the report name if yours is different.

3
Save and test

Save the form, switch to Form View, and click the button. Access opens the report in Print Preview and runs its record-source select query.

4
Print the report

In Print Preview, use the Print command on the ribbon. To print directly instead of previewing, replace acViewPreview in the VBA command with acViewNormal.

Open the report from a form button with VBA
Report View is not direct printing: Use acViewReport to display the report in Report View. Use acViewNormal to send it directly to the printer.
Free Microsoft Office alternative

Create and Print Office Documents with WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with compatible Office documents and printing them. Existing Word, Excel, and PowerPoint files can be opened for an easier transition. WPS Office does not run Access reports or fix Access VBA.

Preview and print documents from a familiar office interfaceCompatible with Microsoft Word, Excel, and PowerPoint formats such as DOCX, XLSX, and PPTXFree and lightweight for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Do I need to run the select query before opening the report?

No. If the select query is the report's Record Source, Access runs it when you open the report with DoCmd.OpenReport.

How do I send the report straight to the printer?

In the button's Click procedure, use DoCmd.OpenReport "131_Fitness_Rpt", acViewNormal. Replace the report name with your own.

Can I create the report button without writing VBA myself?

Yes. In the form's Design View, use the Button control wizard and choose an action to open a report.

What if the report query uses values from the form?

Keep the referenced form open and enter the required control values before clicking the report button. Access uses those values when it runs the report's record-source query.