How to Split an Access Report into Separate PDF Files
Question details
The user needs to export a single Microsoft Access report into multiple individual PDF files, automatically naming each file based on a specific field value (such as a person's name).

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Generating and saving personalized PDF reports for different individuals or groups from a master Access database report.
- Observed behavior
- A single comprehensive Access report must be programmatically divided and saved as distinct PDF files using VBA.
Ensure you have backed up your Microsoft Access database and have basic familiarity with writing and executing Visual Basic for Applications (VBA) code.
Use a VBA Loop to Filter and Export PDFs
The most reliable method is to create a VBA procedure that loops through your target records, filters the report for one individual at a time, and exports the result as a PDF.
Exporting the entire report once and looping through page numbers can be unreliable due to pagination changes or group headers spanning multiple pages. Filtering the RecordSource or WhereCondition ensures each generated PDF accurately reflects only the data for that specific entity.
Launch your Microsoft Access database and press ALT + F11 to open the Visual Basic for Applications (VBA) editor.
Click 'Insert' from the top menu and select 'Module' to create a new blank script window.
Write a VBA sub-procedure that opens a Recordset containing the distinct names or IDs you want to generate reports for. Use a 'Do While Not rs.EOF' loop to iterate through each record.
Inside the loop, use 'DoCmd.OpenReport' with the 'WhereCondition' parameter set to the current record's identifier (e.g., "[PersonID] = " & rs!PersonID) to filter the report.
Use 'DoCmd.OutputTo acOutputReport, "YourReportName", acFormatPDF, "C:\Path\" & rs!PersonName & ".pdf"' to save the filtered report as a PDF.
Close the report using 'DoCmd.Close acReport', advance the recordset with 'rs.MoveNext', and loop until finished.

Export by Looping Through Pages (Alternative)
An alternative approach is printing or exporting the report page by page using VBA, extracting the file name directly from a page header control.
Need a Lightweight Alternative for Your Everyday Office Tasks?
While Microsoft Access is necessary for complex relational database management and VBA reporting, WPS Office is an exceptional free alternative for handling your everyday documents, spreadsheets, and PDF files. It seamlessly opens Microsoft Office formats and includes powerful built-in PDF tools.
- 1. Download and Install: Visit the official WPS Office website to download and install the free suite on your device.
- 2. Open Your Files: Launch WPS Office to easily open your exported PDF reports or any existing Word, Excel, and PowerPoint documents.
- 3. Manage PDFs: Use the built-in PDF toolkit in WPS Office to merge, annotate, or further modify the separate PDF files generated from Access.

Frequently Asked Questions
Can I split an Access report into multiple PDFs without writing VBA code?
No, Microsoft Access does not have a built-in graphical feature to automatically burst or split a single report into multiple distinct PDF files. Writing a VBA macro is required to automate the filtering and exporting loop.
How do I prevent the VBA script from overwriting PDFs if two people have the same name?
In your VBA script, you should include logic that checks if a file with the target name already exists using the 'Dir()' function. If it does, append a unique identifier, such as a primary key ID or a timestamp, to the filename string before executing 'DoCmd.OutputTo'.
Why is it better to filter the RecordSource instead of looping through report pages?
Filtering the RecordSource ensures that the report calculates totals, headers, and footers correctly for that specific dataset. Looping through physical pages can lead to truncated data or incorrect summaries if an individual's report spans more than one page.




