Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

report filter that has no records 1

Status
Not open for further replies.

Lhuffst

Programmer
Jun 23, 2003
503
US
If the report filter returns 0 records, how do I modify the filter to show a message with no data?
If I use the nodata event, I end up with a openreport error 2501. To trap this error, I need the onclick event of the report form which I don't have access to.
I would like to have either a message box pop up saying there aren't any matches for the given criteria OR the report caption (or a text box) to say...No data found
Any ideas anyone? Thanks lhuffst

current filter example
Code:
 [t_Events].[EventCatCode] IN ('INSPECTION','SAMPLE') AND [EventTypeAbbrv] <> 'SELF' AND [COMPLETEDATE] <> NULL
 
If you cancel the printing/displaying of the report, this will cause the 2501 error. If you can't trap for it, then you will probably need to display the report. You can try add a text box to the Page Header section with a control source of:
Code:
=IIf([HasData]=0,"There is no data to display",Null)

Duane
Hook'D on Access
MS Access MVP
 
Great. Thanks I'm leaving for the day but will definitely try it tomorrow. Thanks for the quick response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top