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

How do I Suppress a subreport if there is no data in subreport? 1

Status
Not open for further replies.

Dog2

Programmer
Feb 17, 2003
1
ZA
Hi

Im rather new with Crystal Reports, so PLEASE help me!!! I want to create a subreport that can be viewed via the web. (Im curently using Access to retreve the data). If the subreport contain any data it must show the data, but if there is no data the subreport must not show. Currently the subreports headers and footers is showing, and that is not the result that I want.

Thank You!!!
 
Do you want to suppress the entire subreport, or just its header and footer?

For header and footer, use the supress formula in Format Section. Test for no data - maybe an account number equal to null, it depends on what qualifies.

If you want to supress the subreport completely, this is much harder. Sections can be supressed, but the logic for this is performed before the subreport. The only way is to run the subreport twice. See thread149-467943 for details of how this can be done. Madawc Williams
East Anglia
Great Britain
 
I have this going on in several of my reports. How I handled this was by added a line of code in my query. I am using SQL 2000. I add a select count on the primary key of the sub report where it equals the main report. ( this select is added to the main report query). Then in Crystal I code the suppress property on the subreport. If the count from the main report is null then true else false.

Hope this helps.
Ginger
 
You can also double-click the sub report to edit it, then go to File > Report Options, and click the option that says to suppress printing if no records. Make sure you're editing the subreport and not the main report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top