Problem VBA automatic printing Reports to pdf (1 Viewer)

GinnyR

New member
Local time
Today, 13:47
Joined
Apr 27, 2023
Messages
24
Hi I'm using the following piece of code to automatically print to pdf 4 different reports in an Access DB (2021)

Code:
DoCmd.OutputTo acOutputReport, "ReportName", acFormatPDF, myPathnFile

This is working perfectly for 2 of the reports but not for the other 2. These reports are also manually run for separate purposes. The 2 that it's working for I manually did not set up any print parameters like margins, specific printer, but for the 2 that it's not working I did originally, but removed those settings to match the settings of the 2 reports that work. When I manually run the 2 that work and print no SAVE dialog box presents, but it does for both the reports that don't work. The code appears to stop at this point and cancels the output.

Any suggestions of what I can do to get this working for all 4 reports?

All help appreciated. Thanks
Ginny
 

GinnyR

New member
Local time
Today, 13:47
Joined
Apr 27, 2023
Messages
24
Thanks to sxschech I have a workaround using the DoCmd.Printout command which I found in the similar threads below. Thank you sxschech. It's much appreciated.

I would still prefer to be able to use the direct command DoCmd.OutputTo.
 

Users who are viewing this thread

Top Bottom