Stopping pop up window on No Data

N

Noel

Hi, I have a command button which calls up a report. I
have set up the On No Data Event to display a popup
saying "There is no data to preview". All OK there. The
problem is when I close this window, I get another
annoying message saying "The OpenReport action was
cancelled. You used a method of the DoCmd to carry
out .......". How can I stop this second window from
appearing. It will confuse the users. Thanks, Noel
 
F

Fredg

Trap the error in the form's event that originally opened the Report.

On Error Goto Err_Handler
DoCmd.OpenReport "ReportName", acViewPreview

Exit_This_Sub:
Exit Sub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error " & Err
End If
Resume Exit_This_Sub
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