Print (PDF) First Three Pages of an Access Report

John VT 1 Reputation point

How do I print (PDF) on the first three pages of an Access report?

I have:
Access VBA code that loops through a list of hundreds of customers, opens the preview of the report for the current customer in the loop, and renders the report as a PDF file.
e.g., DoCmd.OutputTo: objecttype:=acOutputReport, outputformat:=acFormatPDF, outputfile:="<file path>"

I want:
To print (PDF) only the first three pages of each report.


  1. Without going into a lot of details on the database structure, I need to take the existing report, and print (PDF) only the first three pages for each customer.
  2. I don't see a page range option in the OutputTo method.
  3. I tried DoCmd.PrintOut, but I am prompted to enter the filename, and don't want to do this hundreds of times. I put the file name in the report caption, but I am still prompted for a file name.
  4. I tried setting the report Detail section property OnPrint to "Cancel = (Page > 3), but this only displays the first three pages, and leave the remaining pages blank. I do not want any blank pages.
  5. I'm using Windows 10, Access 2016

How do I print (PDF) on the first three pages of an Access report? Thank you for any help!

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
834 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. DBG 2,301 Reputation points

    Hi. Without seeing your report, I am not sure I understand why you have more than 3 pages. Perhaps one workaround is to create a separate 3-page report that you can send to PDF. Just a thought...

    0 comments No comments

  2. John VT 1 Reputation point

    Thank you for your fast response. I thought of that too, but it won't work in this specific case (its complicated). I was wondering if someone found a way to restrict the page range with OutputTo or PrintOut.

    0 comments No comments

  3. DBG 2,301 Reputation points

    Hi. PrintOut has a PageFrom and PageTo arguments. However, since you're actually creating a file, rather than create a hard copy, you will get the filename prompt.

    Unfortunately, OutputTo does not have those options.

    The only thing I could think of right now is perhaps set the default printer to Acrobat PDF or Microsoft PDF Printer and then use PrintOut.

    0 comments No comments

  4. Ken Sheridan 2,671 Reputation points

    If you put the following the Format event procedure of all sections, nothing after page 3 should be printed, though you'll probably end up with a blank fourth page, which won't be important if the PDF file is printed to both sides of the paper.

    Cancel = (Page > 3)
    0 comments No comments