> How can get a message box to pop up when there are no records in a report
> that says, "No Records"? On my switchboard I have a list of reports, when I
> click on button report will display data and if no data it displays blank
> page. I rather a message comes up saying no records for specific report.
> Thank for any help on this question.
Code the Report's OnNoData event:
MsgBox "No records to report on."
Cancel = True
Unfortunately, this will cause an error.
You need to trap the error (2501) in whatever event you used to open
the form.
Code that switchboard event:
On Error GoTo Err_Handler
DoCmd.OpenReport "ReportName", acViewPreview
Exit_This_Sub:
Exit Sub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error #: " & Err.Number & " " & Err.Description
End If
Resume Exit_This_Sub

Signature
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
TotallyConfused - 11 Dec 2007 22:30 GMT
Thank you for your response. Once I trap this error, will this eliminate
anymore error messages?
> > How can get a message box to pop up when there are no records in a report
> > that says, "No Records"? On my switchboard I have a list of reports, when I
[quoted text clipped - 22 lines]
> End If
> Resume Exit_This_Sub
fredg - 12 Dec 2007 04:56 GMT
> Thank you for your response. Once I trap this error, will this eliminate
> anymore error messages?
[quoted text clipped - 25 lines]
>> End If
>> Resume Exit_This_Sub
Well, no. It will only eliminate the message regarding error 2501.
if you get a different error, then the Else portion of the code will
run and Access will give the error number and description message so
that you can take the necessary steps to correct that error.

Signature
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail