Suppressing Message Box

D

DubboPete

Hi all,

I have a report, which, if someone tries to print and there is no data
for the report, comes up with a custom message alerting the user, and
the OpenReport action is cancelled. On clicking ok, I then get the MS
Access message "The OpenReport Action was cancelled" popping up too.

Is there any way to suppress the Access message?

tia

DubboPete
 
F

fredg

Hi all,

I have a report, which, if someone tries to print and there is no data
for the report, comes up with a custom message alerting the user, and
the OpenReport action is cancelled. On clicking ok, I then get the MS
Access message "The OpenReport Action was cancelled" popping up too.

Is there any way to suppress the Access message?

tia

DubboPete

Code the event that is used to open the report:

On Error GoTo Rrr_Handler

DoCmd.OpenReport "ReportName" etc...

Exit_Sub:
Exit Sub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error #: " & Err.Number & " " & Err.Description
End IF
Resume Exit_Sub
 
D

DubboPete

fredg said:
Code the event that is used to open the report:

On Error GoTo Rrr_Handler

DoCmd.OpenReport "ReportName" etc...

Exit_Sub:
Exit Sub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error #: " & Err.Number & " " & Err.Description
End IF
Resume Exit_Sub

Thanks Fred,

I actually had to put it in the OnClick code of the command button that
fired the report, but it worked perfectly!
many thanks

Pete
 
F

fredg

Thanks Fred,

I actually had to put it in the OnClick code of the command button that
fired the report, but it worked perfectly!
many thanks

Pete

Isn't that what I wrote?
 

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