DoCmd.PrintOut to pdf doesn't respect the copies setting? RRS feed

  • Question

  • I have a client that uses Access 2003 on Windows XP to print multiple pdfs of the same report using DoCmd.PrintOut.

       DoCmd.OpenReport "rptTest", acViewPreview
       DoCmd.PrintOut , , , , 2

    We're trying to move him to windows 10 and Access 2016. However PrintOut copies param doesn't seem to be respected in this context (win 10 + access 2016). The report is formatted to use pdf as the printer (either adobe acrobat or the msft pdf printer option). On XP + A2003, the code above prompts the user for a file name twice, which is what he wants. On win 10 + A2016, it asks for a file name one time and that's it. If the report is saved to print to a physical printer, it does print two copies with the same code. It'd be easy to code a workaround, and I expect to take that route, but does anyone know if this is a known issue?

    Thursday, December 20, 2018 3:30 AM

All replies

  • Rather than sending the report to a virtual printer, you can use the OutputTo method of the DoCmd object to output the report as a PDF file.  You'll find an example in InvoicePDF.zip in my public databases folder at:


    Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to  amend the form design accordingly.  

    If you have difficulty opening the link, copy the link (NB, not the link location) and paste it into your browser's address bar.

    This little demo file includes an option to create multiple PDF files.  In my case separate invoices are selected from a multi-select list box, and the code loops through the list box's ItemsSelected collection and build the path by which to save the file.  It also opens the files.  In your case you'd simply loop from 1 to n and remove the last two arguments from the line in my demo, so that it simply prompts for a file name each time and creates each file invisibly; so the line of code would be like this:

        DoCmd.OutputTo acOutputReport, "rptInvoiceMultiple", acFormatPDF

    Note that, using this method, a report cannot be filtered in the same way as can be done with the WhereCondition argument of the OpenReport method; it must be restricted by means of one or more parameters in the report's query.  In my demo the invoice number on the main invoice form is referenced as the parameter.

    Ken Sheridan, Stafford, England

    Thursday, December 20, 2018 12:21 PM
  • Hi Ken and thanks for that. There are many ways to work around this apparent bug in later versions of Access and the one you've shown in your example is good. But I was writing here to confirm if others have seen this change in Access; ie is it a real bug or...? It does seem to be a bug, as it does output multiple pdfs on xp and earlier Access versions.
    Thursday, December 20, 2018 4:20 PM
  • The behaviour does not seem to be limited to Access, or even to Office.  I've just tried, in Windows 10, sending multiple copies of both Word and text files to a virtual PDF printer.  In both cases the file dialogue opened once only, and only one File was created.

    Ken Sheridan, Stafford, England

    Thursday, December 20, 2018 4:56 PM
  • Yeah, I was also thinking it may be an other than Access issue.
    Thursday, December 20, 2018 5:25 PM