Run-time error '2501'


I have a command button in Access 2007 that is supposed to save a report called "CycleReportFresh" as a pdf file in a specified directory under a specified name. It gives me the following error message:

Run-time error '2501': The OutputTo file action was canceled.

What is wrong with this code?


Private Sub Command193_Click()

DoCmd.OutputTo acOutputReport, "CycleReportFresh", acFormatPDF, "C:\My Documents\Work\P-Data\D-B\rptFoo.pdf"


End Sub


Thank you


Question Info

Last updated March 6, 2019 Views 5,483 Applies to:
DId you create that directory?  Because there is no *C:\My Documents\...* on Windows 7 machines, it would C:\Users\YourComputersName\Documents\*
Gina Whipp
Microsoft MVP (Access 2010-2015)

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.