Message Box

  • Thread starter Thread starter Nat
  • Start date Start date
How can I have a Message box popup whenever data on the
report is NULL.

Thank you
Nat

Do you mean when the entire report has no data to print, or if a field
in the report has no data to print?
 
When the report has no data to print.
-----Original Message-----


Do you mean when the entire report has no data to print, or if a field
in the report has no data to print?
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
 
When the report has no data to print.

Code the Report's OnNoData event:
MsgBox "There are no records to show in this report"
Cancel = True

The above will give an error if you have opened the report from a
command button event on a form.

Add error handling to the command button event to trap for error 2501.

On Error GoTo Err_Handler
DoCmd.OpenReport "ReportName" etc.

Exit_ThisEvent:
Exit Sub

Err_Handler:
If Err = 2501 then
Else
MsgBox "Error #: " & Err.Number & " " & Err.Description
End If
Resume Exit_ThisSub
 
Back
Top