On No Data

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

I am opening a report from a form that prompts for data. When I open the
form and there is no data to display, I have the following code:

Private Sub Report_NoData(Cancel As Integer)
MsgBox "No Data To Display, Please Select Another Zone", vbOKOnly
End Sub

This works except the problem is that it displays the msgbox, and I click
OK, it displays it a second time. The only thing that I can think of is
that the query that the report is bound to has two tables that are related.
Could that be causing the second display of the msgbox?

Any help would be appreciated!!

Daniel
 
If you use the OpenReport action/method and cancel the NoData event, the 2nd
message is probably error 2501. The code that opened the report is being
notified that the OpenReport did not succeed. Use error handling in that
code to suppress the 2nd message.
 
You should also set the Cancel argument to True, to prvent printing a blank
repoprt.

Ragnar
 
Back
Top