Access2002: DoCmd.OpenReport Error

  • Thread starter Thread starter Mary H.
  • Start date Start date
M

Mary H.

Hello,

I am running code in Access2000, which worked fine. When I
run the same code (i.e. file) in Access2002 the programm
quits with the message: Microsoft Access has encountered a
problem and needs to close.... This happens when processing
the line:

Docmd.OpenReport stDocName, acPreview

What's wrong with this line?
I can open the Report with the OpenReport-Command in a
Macro and of course I can open it from the database window.

Would we very greatful for any help.

Thank you in advance.
Mary H.
 
The error probably indicates that some kind of corruption has taken place in
your database. The line should work if stDocName has been set to the name of
your report. You might try using acViewPreview in place of acPreview, but I
would not expect that to solve the issue.

1. Make a backup while Accesss is not running, and without overwriting any
other backups.

2. Compact/repair the database: Tools | Database Utilities | Compact.

3. If the problem is still present, try a decompile. Close Access again, and
try this under Start | Run. It's one line, and include the quote marks, and
use the actual name of your database:

"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\My Documents\MyDatabase.mdb"

4. If you are still stuck, create a new (blank) database, and import all the
objects from the broken one (File | Get External | Import).
 
Hello Allen,

first, thank you for your answer.

That was my fear, that something is wrong with Access or
the database file. I'll try your steps and will give
results than.

Thank you for now.
Mary H.
 
Back
Top