Others

How to Open an Access Report in Print Preview with VBA

Bushra ParveenBushra Parveen Nov 2, 2026 869 views

Question details

The user needs to open an MS Access report in Print Preview mode so that the Detail_Format event runs, which is necessary for populating unbound text boxes during report formatting.

How to Open an Access Report in Print Preview with VBA
Product
Microsoft Access
Device & OS
not provided
Scenario
Triggering formatting events for unbound text boxes during Access report generation.
Observed behavior
When opened in Normal view from the object list, the Detail_Format event does not run. The report must be explicitly opened in Print Preview, but the view cannot be changed from the report's own Open or Load events.
Before you start

Ensure you have your Access database open in Design View. Note that a report's view mode cannot be changed from its own Open or Load events once it has started opening.

Solution 1Recommended

Use VBA DoCmd.OpenReport from a Form

The best practice for deployed databases is to open reports using a command button on a form with VBA, specifying the Print Preview mode.

In a deployed database, users generally should not access the Navigation Pane directly. Instead, you should control how reports open by using a VBA command behind a form button.

1
Open Form in Design View

Right-click your navigation or main form in the Navigation Pane and select Design View.

2
Add a Command Button

Drag a Command Button from the Design ribbon onto your form.

3
Access the VBA Editor

Select the button, open the Property Sheet, navigate to the Event tab, and click the ellipsis (...) next to the On Click event. Choose Code Builder.

4
Enter the VBA Code

In the VBA editor, type the following code: DoCmd.OpenReport "YourReportName", acViewPreview

5
Test the Print Preview

Save your VBA module, return to Form View, and click the button to open your report in Print Preview with the Detail_Format event fully enabled.

Use VBA DoCmd.OpenReport from a Form
Free Microsoft Office alternative

Looking for a Lightweight Office Suite Alternative?

While troubleshooting Microsoft Office database issues, consider exploring WPS Office for your document, spreadsheet, and presentation needs. WPS Office provides a free, lightweight, and easy-to-use alternative to Microsoft Office.

  1. 1. Visit the Website: Go to the official WPS Office website to find the installer.
  2. 2. Download the Installer: Click the free download button for your specific operating system (Windows, Mac, or Linux).
  3. 3. Install and Launch: Run the setup file and start enjoying a fully compatible, robust office suite.
Seamlessly compatible with Microsoft Excel, Word, and PowerPoint formats.Free, lightweight design that installs quickly and runs smoothly.Familiar tabbed interface requiring zero learning curve for Office users.Built-in PDF editing capabilities for comprehensive document management.
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't the Detail_Format event running in my Access report?

The Detail_Format event only triggers when a report is opened in Print Preview mode or when it is physically printed. It will not run in the standard Report View (Normal view).

Can I change the report view using VBA inside the report's On Open event?

No. Once a report begins to open, its view mode is already locked. You cannot use the Open or Load events within the report itself to switch to Print Preview; it must be called correctly from the outside (like from a form).

How do I hide the Navigation Pane from users in a deployed Access database?

Go to File > Options > Current Database, and uncheck 'Display Navigation Pane'. This encourages users to navigate using your custom forms and VBA command buttons instead of opening objects directly.