Printing Problems

Fix Microsoft Access Printing Main Form Instead of Current Report

Steve KSteve K Sep 27, 2026 871 views

Question details

The user needs to prevent Microsoft Access from printing or emailing the main form when they intend to output the current report for a specific active record.

Fix Microsoft Access Printing the Main Form Instead of the Current Report
Product
Microsoft Access
Device & OS
not provided
Scenario
Printing or emailing a specific report, such as a donation form or tax receipt, from an active database form.
Observed behavior
Microsoft Access prints, opens, or emails the main form or an unfiltered report instead of the intended report for the current record.
Before you start

Before modifying your event macros, identify the exact primary key field (e.g., DonorID or InvoiceID) on your active form, as you will need this to construct the correct WhereCondition.

Solution 1Recommended

Use WhereCondition to Filter the Current Report in VBA

Apply a WhereCondition to the DoCmd.OpenReport or DoCmd.SendObject command to ensure only the current record is processed.

When an Access form triggers a report without specific filtering instructions, it defaults to printing the active object (the form itself) or the entire unfiltered report. Explicitly passing a WhereCondition restricts the output to the active record.

1
Open the form in Design View

Launch your Access database, right-click the main form containing your print or email button, and select 'Design View'.

2
Access the VBA Builder

Right-click the specific Print or Email button, select 'Build Event' from the context menu, and choose 'Code Builder' to open the VBA editor.

3
Add the WhereCondition parameter

Locate your `DoCmd.OpenReport` or `DoCmd.SendObject` line. Add a WhereCondition parameter that links the report's ID to the current form's ID, formatted like: `DoCmd.OpenReport "rptTaxReceipt", acViewPreview, , "[DonorID]=" & Me.DonorID`.

4
Save and test the macro

Save the VBA code, return to Form View, and click the button to verify that only the receipt for the currently selected donor is generated.

Use WhereCondition to Filter the Current Report in VBA
Syntax check: Ensure your quotation marks and ampersands are placed correctly, especially if your primary key is a text string rather than a number, which would require single quotes around the value.
Free Microsoft Office alternative

Manage Invoices and Receipts Easily with WPS Office

Dealing with complex VBA macros and Access databases can be frustrating when you simply need to generate and print invoices or tax receipts. WPS Office provides a free, lightweight, and highly compatible alternative. You can easily organize your data and automate professional invoices using WPS Spreadsheet without any complicated programming.

Highly compatible with Microsoft Office formats, seamlessly opening Excel (.xlsx) files exported from Access.Easily format, print, and export your invoices and receipts to PDF directly within WPS Spreadsheet.Lightweight and completely free, saving you from complex database configurations and expensive subscriptions.Familiar tabbed user interface ensures a zero-learning-curve transition.
microsoft office alternative - wps office

Frequently Asked Questions

Why does DoCmd.SendObject attach the main form instead of my report?

This typically occurs if the report name is incorrectly specified in the command parameters or left blank, causing Access to default to outputting the currently active object, which is the form you clicked the button on.

How do I filter a report without using VBA code?

You can use Access Macros instead of VBA. Open the Macro Builder, use the 'OpenReport' action, and set the 'Where Condition' argument to something like `=[DonorID]=[Forms]![YourFormName]![DonorID]`.

Can I use WPS Office to open Microsoft Access (.accdb) database files?

No, WPS Office is an office suite featuring Writer, Spreadsheet, Presentation, and PDF tools; it does not include a direct relational database application like Access. However, you can export your Access tables to Excel (.xlsx) format and easily open and manage them in WPS Spreadsheet.