How handle query returns no data (In report) ?

D

David

What is the best way to handle the case where a query returns no data.
This is in a report.
THis may heppen because the user can select various filtering criteria that may result in no output.
 
F

fredg

What is the best way to handle the case where a query returns no data.
This is in a report.
THis may heppen because the user can select various filtering criteria that may result in no output.


Use the Report's OnNoData event.

MsgBox "there are no records returned for this report"
Cancel = True.
 
C

chris

Not necessarily the best, but try...

Private Sub Report_NoData(Cancel As Integer)
'your messagebox
Cancel = True
End Sub


This will raise a "report cancelled" error in the calling
routine, trap and suppress it there.

-----Original Message-----
What is the best way to handle the case where a query returns no data.
This is in a report.
THis may heppen because the user can select various
filtering criteria that may result in no output.
 
Top