Message Box

H

Haigy

in the No Data event for a report i have a msgbox that informs that there is
no data, when you click on ok on the message box i get another message box

The OpenReport action was canceled

is there a way to stop this showing

thanks
 
R

Rick Brandt

Haigy said:
in the No Data event for a report i have a msgbox that informs that there is
no data, when you click on ok on the message box i get another message box

The OpenReport action was canceled

is there a way to stop this showing

Your code that opens the report needs to trap for errors. Then your error handler
can be set up to ignore error number 2501 (raised whenever a DoCmd... is cancelled).

On Error GoTo ErrHandler

DoCmd.OpenReport "SomeReport"

Egress:
Exit Sub

ErrHandler:
Select Case Err.Number
Case 2501
'ignore
Case Else
Normal Error Handling Goes Here
End Select
Resume Egress
End 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