OpenReport command cancels by itself

K

Keith

I have an Access 2000 db with a front end / back end design. All users have
Win2K or WinXP sp2. Database has been running fine for at least a year
(bought the XP machines in Nov 2004). Now on ONE machine ONLY, a
DoCmd.OpenReport command throws an error. My code looks like:

on error resume next
docmd.openreport ...
if err then ...

When I step through the program on that machine, the docmd.openreport
generates an error with err.description = "The OpenReport command was
cancelled"

It makes no sense to me. Could someone help point me in a direction to try?
Or should I just reinstall Access?

Thanks,
Keith
 
F

fredg

I have an Access 2000 db with a front end / back end design. All users have
Win2K or WinXP sp2. Database has been running fine for at least a year
(bought the XP machines in Nov 2004). Now on ONE machine ONLY, a
DoCmd.OpenReport command throws an error. My code looks like:

on error resume next
docmd.openreport ...
if err then ...

When I step through the program on that machine, the docmd.openreport
generates an error with err.description = "The OpenReport command was
cancelled"

It makes no sense to me. Could someone help point me in a direction to try?
Or should I just reinstall Access?

Thanks,
Keith

That's probably error #2501.
Your report may have a Cancel = True in the OnNoData event which has
fired because your report has no data.
If this is so, then simply change your command button code to:

On Error GoTo Err_Handler
DoCmd.OpenReport etc....
Exit_Sub:
Exit Sub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error #: " & Err.Number & " " & Err.Description
End If
Resume Exit_Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top