logo
search
Others

How to Export Individual Access Report Records as Separate PDF Files

Bushra ParveenBushra Parveen Sep 28, 2026 869 views

Question details

The user needs to export a single Microsoft Access report into multiple separate PDF files, where each PDF represents an individual record and is named dynamically based on a unique field value.

Export Individual Access Report Records as Separate PDF Files
Product
Microsoft Access
Device & OS
not provided
Scenario
Generating individual PDF files for specific database records directly from an Access report using a custom identifier (like DocNum or CTOCUNUM).
Observed behavior
Instead of unreliably splitting a master multi-page PDF report by page numbers, the user must filter the report by individual record identifiers and export them one by one.
Before you start

Ensure you have basic familiarity with Microsoft Access VBA (Visual Basic for Applications) and that the table or query feeding your report contains a unique identifier field (such as DocNum) to isolate individual records.

Solution 1Recommended

Use VBA and DAO Recordset to Filter and Export Records

Write a VBA script to loop through a DAO recordset, filter the report for each specific record, and export it as an independent PDF.

Rather than thinking in terms of printed pages, the most reliable method is to filter the report by the data that represents each record. By identifying a key field (e.g., DocNum or CTOCUNUM), you can use VBA to restrict the report to one record at a time and output it securely to a designated folder.

1
Open the VBA Editor

In your Microsoft Access database, press ALT + F11 to open the VBA Editor. You can create a new Module or place the code within the OnClick event of a command button on your form.

2
Define the DAO Recordset

Write an SQL query to retrieve the relevant key values you wish to export. For example: Dim rst As DAO.Recordset Set rst = CurrentDb.OpenRecordset("SELECT * FROM Documents WHERE DocNum LIKE '*24-52*'")

3
Loop Through the Records and Build the File Path

Create a Do While Not rst.EOF loop. Inside the loop, construct the unique file path using the key field to name the PDF dynamically: strFullPath = "C:\Your\Path\Here\" & rst.Fields("CTOCUNUM") & ".pdf"

4
Output the Filtered Report

Use the DoCmd.OutputTo command to generate the PDF. Pass the report name and the generated file path: DoCmd.OutputTo acOutputReport, "YourReportName", acFormatPDF, strFullPath, False. (Setting the last argument to False prevents the PDF from opening automatically after creation).

5
Move to the Next Record

Before closing your loop, use rst.MoveNext to proceed to the next record in your dataset, ensuring all queried records are exported individually.

Use VBA and DAO Recordset to Filter and Export Records
Reliable Exporting: Using a data-driven loop avoids the pitfalls of page-based splitting, guaranteeing that reports spanning multiple pages for a single record are kept together in one file.
Free Microsoft Office alternative

Looking for a Lightweight Alternative for Your Office Needs?

While Microsoft Access handles complex relational databases, WPS Office is the perfect free, lightweight, and highly compatible alternative for your everyday document, spreadsheet, presentation, and PDF management needs.

  1. 1. Download the Installer: Visit the official WPS Office website and click the free download button.
  2. 2. Install WPS Office: Run the downloaded installer and follow the simple on-screen instructions to set up the suite on your device.
  3. 3. Manage Your PDFs and Documents: Open your generated PDF reports, Word documents, or Excel files directly in WPS Office to edit, organize, or share them effortlessly.
Fully compatible with Microsoft Word, Excel, and PowerPoint formats (.docx, .xlsx, .pptx).Built-in advanced PDF toolkit for easy reading, editing, merging, and conversion of PDF reports.Free and lightweight, consuming minimal system resources while offering powerful features.Familiar user interface requiring zero learning curve for a seamless migration.
microsoft office alternative - wps office

Frequently Asked Questions

Can I split an Access report into separate PDFs without using VBA code?

Natively within Microsoft Access, there is no reliable way to split a report into individual PDFs per record without VBA. While you could export the entire report as a single multi-page PDF and use a third-party PDF splitter tool, this method is unreliable if a single record happens to span across multiple pages.

Why do my exported PDFs keep opening automatically and interrupting the process?

This happens if the 'AutoStart' argument in your DoCmd.OutputTo code is set to True. To stop the PDFs from opening automatically, locate the DoCmd.OutputTo line in your VBA code and change the final argument to False, or simply omit it.

How do I ensure the dynamically generated filename is valid?

When building your file path (e.g., using rst.Fields("DocNum")), ensure that the data in that field does not contain characters that Windows forbids in filenames, such as slashes (/, \), colons (:), asterisks (*), question marks (?), quotes ("), or pipes (|). You may need to use a VBA Replace function to sanitize the string if your field contains these characters.