Stopping pop up window on No Data

  • Thread starter Thread starter Noel
  • Start date Start date
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
 
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
 
Back
Top