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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subreports show label instead of blank space when there is no data

Status
Not open for further replies.

mtabt

Technical User
Apr 25, 2001
23
US
I have a report with about 6 subreports. In some cases, some subreports do not have any data. In those situations, I would like to replace the subreports with a label showing "No Data". I would like the labels to be in the same space where the subreports are. Basically, instead of showing a blank space, I would like to show "No Data".

Any help would be appreciated. Thank you.
 
1) place your label on the subreport. Make sure it "covers" the data area. Bring it to the 'front', but make it invisible.

2) in the NO DATA event for the report, stick a line of code to make the label visible.

I have the exact same situation and it seems to work for me - it's a main report with nothing more than two subreports - sometimes, the second report has no data, and so it just prints an informative message there instead.

78.5% of all statistics are made up on the spot.
Another free Access forum:
 
Thanks for your reply,

In your report, is the Label in the subreport or in the main report on top of the subreport box? Also, is it the NO DATA Event in the subreport or the main report? I tried this solution before with every possible combinations, and I can't seem to get it to work.

Please help. Thank you.
 
Ok - sorry, I was having a senior moment last night (prodded by several ounces of Dewars, I might add..)

Put a TEXT BOX on your MAIN report, just below where the subreport control is.

the CONTROL SOURCE for this text box is thus:

=IIf([Your-subreport Name].[Report].[HasData]," ","Sorry, there is no data for this report")

You have to use the HASDATA property, because a sub report doesn't kick off the NO DATA event for a report.

The text box is just a blank if there is a subreport with data.

I have a page break command separating my two subreports, so Report-2 always gets a new page. If there is no data there, the text box prints about 1/3rd the way down the page.

Hope this helps - sorry about the confusion.


Ex-JimAtTheFAA
78.5% of all statistics are made up on the spot.
Another free Access forum:
 
Thank you very much, you have been very helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top