Conditional Subtotal

  • Thread starter Thread starter Al
  • Start date Start date
A

Al

I have a group and a subgroup. I need a conditional
subtotal for the subgroup ONLY when the sum of the
subgroup is less than the sum of the group. if the sum of
the subgroup is equal to the sum of the group I do NOT
need the subtotal calculated. How can this best be
accomplished? Thanks in advance.
 
Al said:
I have a group and a subgroup. I need a conditional
subtotal for the subgroup ONLY when the sum of the
subgroup is less than the sum of the group. if the sum of
the subgroup is equal to the sum of the group I do NOT
need the subtotal calculated.


You can't look ahead to a group footer to see what the total
will be, however, if you using the Sum function to calculate
the total, you can also use the Sum function in the group
header section and that will be availble in all of the
subgroups. You can then cancel the subgroup's footer
section's Format event if its total is the same as the main
group total. Example code for the subgroup's footer
section:

Cancel = (Me.subgrouptotal = Me.mainheadertotal)
 
Thanks Marsh!! That worked!
-----Original Message-----



You can't look ahead to a group footer to see what the total
will be, however, if you using the Sum function to calculate
the total, you can also use the Sum function in the group
header section and that will be availble in all of the
subgroups. You can then cancel the subgroup's footer
section's Format event if its total is the same as the main
group total. Example code for the subgroup's footer
section:

Cancel = (Me.subgrouptotal = Me.mainheadertotal)
 
Back
Top