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

Displaying Group Footers Conditionally 1

Status
Not open for further replies.

Shamous

IS-IT--Management
Jun 23, 2001
82
US
I have a report with two groups.

Group0 Header
Group1 Header
Detail
Group1 Footer
Group0 Footer

All groups(0 and 1) contain "Totals" for the report.

Each Group Footer is the same, and I do need both. What I would like to do is suppress the Group1 footer if there is actually no group(ing) needing to be done, because there is only one item for the Group(1). If there are two or more items in Group1 then group0 footer would be the sum total of the group1 footer.

How can I suspend the group from showing?

Thanks.

Rusty
 
You can't stop a single footer from appearing but you could make the contents invisible.
Create an invisible field which counts the number of items e.g. Footer_count = count([Fieldname])
Try this code in the group footer Print.
If Footer_Count = 1 Then
Footer_Field1.Visible = False
Footer_Field2.Visible = False
etc.
Else
Footer_Field1.Visible = True
Footer_Field2.Visible = True
etc.
End If

Simon Rouse
 
Actually this would be possible. To suppress a group footer when that group only contains one record:

Add an invisible text box to your detail section. Call it txtRunningSum. Set its control source to =1 and its Running Sum property to Over Group.

In the On Format event of your group footer, place code like this to cancel the printing of the footer if txtRunningSum = 1 (only one record exists for that group):
Code:
If [txtRunningSum] = 1 Then
   Cancel = True
End If

Hoc nomen meum verum non est.
 
Brilliant CosmoKramer - never thought of that! Have a star on me
 
Cosmo, Your code worked sort of. When I applied it following your instructions, it did indeed supress the Group footer when only 1 grouping was done. However when I came to a record where 2 groupings need to be done, instead of letting them both be seen, which is what I need, it supresses the first one and then display the totals for the second one, plus the report footer. That seems to be the default.
 
Thanks CosmoKramer - this was very helpful.

I have a situation where I am using a group footer for summary information on a summary report (detail section is not visible) and I only want to print the summary records for hours > than an input parameter.

If I use CosmoKramer's code & specify the number of hours, i.e.

If [SumTotalHours] < 8 Then
Cancel = True
End If

it works like a charm and prints only those summary records where SumTotalHours is greater than or equal to 8. However, if I modify it so that the code is:

If [SumTotalHours] < [HoursSelect] Then
Cancel = True
End If

then the only records which print are those where SumTotalHours is null, instead of the records where SumTotalHours is the value of HoursSelect (using 8 as my test HoursSelect input) or more.

Currently, HoursSelect is coming from the Query the report is based upon.

Thanks in advance for your help,

Debbie
 
Actually, I just realized that when I hard code the number it isn't QUITE correct either - since it also prints the records when SumTotalHours is Null as well as those greater than or equal to the hardcoded value (8)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top