Code the Report's OnNoData event:
MsgBox "Sorry, no records to report on."
Cancel = true
The above will generat error 2501 if you have opened the report from
an event.
Trap the error in that event:
On Error Goto Err_Handler
DoCmd.OpenReport "ReportName", acViewPreview
Exit_This_Sub:
ExitSub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error #: " & Err.Number & " " & Err.Description
End If
Resume Exit_This_Sub