run time error 2501

k2sarah

New member
Local time
Today, 15:32
Joined
Sep 13, 2010
Messages
2
i need to generate 100 pdf from a report. i export these reports to pdf files. occassionally, i receive a runtime error 2501 error. does anyone know the cause of this error.
 
Do you have code in the no data event of the report to cancel it when there's no data? That's the most common reason, the solution for which is to trap for the error in the code that opens the report.
 
I am having a similar problem. I receive run time error 2501 whenever I attempt to create a pdf file from a report using:
DoCmd.OutputTo acOutputReport, "Data", acFormatPDF, "PathToFile.pdf", False

I am using Access 2010 and Acrobat Pro X. This problem just started and occurs in database applications where this code had previously worked. Could a recent security patch have caused this problem?

Does anyone have any suggestions? Thanks in advance!
 
Thanks for responding, but the problem seems to have fixed itself. Maybe rebooting helped, though I still had the problem right after doing so. A few hours later, it just started working. Go figure.
 
Don't forget to enclose Data in square brackets... [Data]
 
Data was not really the name of the report and the problem occurred with all reports.
 
So there's no loop that generates pdfs? Can I see your entire code
 
I appreciate your dilligence here, but the problem was not in the code because it worked in the past and now works again. I even a created a new access database with one table, one query, one form and one button to run and export the one report. There was one line of code on the click event:

DoCmd.OutputTo acOutputReport, "Data", acFormatPDF, "PathToFile.pdf", False

I have noticed that Access 2010 is a little unstable. When creating an mde from an mdb, Access will often stop responding and crash. After that happens, if I relaunch the application, I may not be able to view code behind any form without crashing the application again. In those cases, I will have to open the database in Access 2003, compact and repair, and then try to open it again in Access 2010. Anybody else have that experience?
 
Last edited:
Sounds like you might be experiencing a bit of corruption. It might be worth creating a new database shell and importing your objects into it.
 

Users who are viewing this thread

Back
Top Bottom