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!

No Data for SubReport

Status
Not open for further replies.

medic133

Technical User
Apr 7, 2002
86
US
I have a report that is nothing but labels for a subreport. I have set up a No Data event on the subreport so that the subreport is cancelled on No Data. My problem is, my main report opens displaying only the labels. What I would like to have happen is the report not to open but to display a message box stating there is no data. I am able to successfully do this with my other reports, but they all have data which can be recognized by the No Data event. What I think I want to do is place an if...then... statement in my main report so that if there is no data on the subreport, my main report will close and a message box will appear. Can anyone tell me where within the main report code I should put this and how do I refer to the subreport in my if...then... statement? Any suggestions would be greatly appreciated. Thanks in advance!
 
It might be easier to use the HasDate property for a subreport and then use an IIF statement to show on the main report when it opens that there is no data to show. For Example; in a text box on your main report add something like this. You will need to replace my entries with your own.
Code:
=IIf([Reports]![rptMain]![srptYourSubReport].[Report].[HasData]=0,"No Data",[Reports]![rptMain]![srptYourSubReport]![TotalAmountPaid]-[Appeal_Goal])

Hope this helps. Search Access Help on HasData.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top