Reports Not opening First time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a strange thing happening with the reports in my database.

None of the reports will open the first time they are accessed, all I get is
an error message with Runtime Error 2501 - The OpenReport Action was
cancelled.

This only happens for the first report that is accessed once the database is
started, eg. if i open the databse and attempt to open report A it fails , if
I try report A again it works, and all other reports then work. Also If I try
report A first and get the error then try report B, report B will then work,
as will all other reports 9Hope this makes sense?)

I have a whole bunch of reports that do various things, and all are fired in
different ways, some via command buttons on a form, some via events on form
fields, and some from the switchboard, and it happens to them all.

Research tells me that 2501 means that there's no data for the report (Where
can I get hold of a list of what the error numbers mean?) which is untrue, as
when the report is run for the second time with the same criteria in the
underlying queries they work ok.

Any help anyone has in solving this would be much appreciated.

Thanks

Neil
 
Error 2501 just means the report was cancelled.

If you cancel the NoData event, that (naturally) produces a 2501, but there
are many other ways to generate that error also, such as cancelling
Report_Open, or pressing Ctrl+Break while Access is working on getting the
report open.

If you regularly get that message on the first report opened in an Access
session--regardless of which report or how it was opened--it probably
indicates a corruption of the database. It could be an AutoName corruption
(esp. since it happens even when there is on code), or it could be a
compilation corruption (esp. if the reports have modules.)

Either way, try this sequence:

1. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

2. Compact the database to get rid of this junk:
Tools | Database Utilities | Compact

3. Close Access. Make a backup copy of the file. Decompile the database by
entering something like this at the command prompt while Access is not
running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

4. Open Access, and compact again.

Post back if there are still problems after this. BTW, the Name AutoCorrupt
problem only applies to Access 2000 and later.
 
Thanks Allen,

First two steps worked ok, although I've done the others just to be sure.

Can't believe I never saw this on your site, it's usually one of the first
places I look for help!

Thanks again

Neil
 
Back
Top