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 to check a section and/or a subreport if is empty ? 1

Status
Not open for further replies.

virgilash

Technical User
Jun 25, 2007
12
CA
How to check a section and/or a subreport if is empty (programatically I mean - with a function maybe) ?
a. I want to show a text box if a subreport is empty
b. I want to disable a section if another one is empty (note for b: I have 2 sections : GH! , GH@ - what I want is to hide GH1 if GH@ is empty ...)

Thank you very much!
 
virgilash,

to answer question a:
What I have done is create a second report header section (ie: Report Header b) containing the text block i want to show if empty, then used conditional suppression on the section... I took a field that occurred in every record and based my suppression in this.
Code:
[blue]not[/blue]([blue]isNull[/blue]({UserTable.UserName}))
I would think you can also base this on the number of records... suppress when RecordCount>0.

Hope this helps

Mike
______________________________________________________________
[banghead] "It Seems All My Problems Exist Between Keyboard and Chair"
 
Create a section that says something like *** No Subreport Data***, in the subreport report footer.
Right-click on the section and choose Format Section. Then choose the formula icon (x+2 and a pencil) for suppression.
Test not isnull({your.field})
The section will appear when the subreport has no records and otherwise be suppressed.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
These solutions are not working - it seems that when the subreport contains 0 rows, it doesn't have report header/footer or any other section where I may eventually place some kind of message to be displayed ... Any other solution would be more than welcome ... Please !!

Thank you very much for any solution!
 
Madawc,

I used your suggestion on a sub report to print ' ~ No Shipments ~' when no records existed in the subreport. I chose the 'Shipment #' field in my database to test and it works great! Thanks.
 
virgilash,

Make sure you don't have the subreport formatted to "suppress blank subreport". Also within the sub, check file->report options->make sure "suppress printing if no records" is not checked.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top