Share via

Run-time error '2501'

Anonymous
2013-03-27T21:48:08+00:00

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

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2013-03-27T22:32:22+00:00

DId you create that directory?  Because there is no *C:\My Documents...* on Windows 7 machines, it would C:\Users\YourComputersName\Documents\*

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-03-28T01:47:26+00:00

    You're most welcome!

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-03-28T01:43:18+00:00

    Thank you! You are absolutely right. I managed to get windows explorer show the path to the directory that could be pasted into the code and now it works like magic. Thank you again!

    Was this answer helpful?

    0 comments No comments