Run-time error '2501'

Hi,

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 August 9, 2018 Views 4,983 Applies to:
Answer
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)
https://www.access-diva.com/tips.html

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.