Suppress total for first record of a group

  • Thread starter Thread starter Goldar
  • Start date Start date
G

Goldar

I have a table that contains records that have fields for Account number,
amount and sequence number. If a group only contains one record (seq #=0), I
want to print it and have it's total included in the group total. If the
group contains more that one record (seq #=0..n), i want to suppress printing
for the first record and not have it's [amount] field included in the group
total. I can suppress printing by setting the Detail Section's visible
property to false for that record, but it's [amount] is still included in the
group total. How can I accomplish this?

Thanks...
 
Goldar said:
I have a table that contains records that have fields for Account number,
amount and sequence number. If a group only contains one record (seq #=0), I
want to print it and have it's total included in the group total. If the
group contains more that one record (seq #=0..n), i want to suppress printing
for the first record and not have it's [amount] field included in the group
total. I can suppress printing by setting the Detail Section's visible
property to false for that record, but it's [amount] is still included in the
group total.


To suppress the first record, you need a group header text
box that has the number of detail records in the group. Add
the text box (named txtNumRecs) with the expression
=Count(*) Then you can use a line of code in the detail
section's Format event:

Me.Section(0).Visible = (txtNumRecs=1)

To calculate the total without the first record, use a text
box (named txtRunTotal) in the detail section. Set its
RunningSum property to Over Group and use an expression
like:
=IIf([Seq #]=0 And txtNumRecs>1, 0, Amount)

The group footer total text box expression would then be:
=txtRunTotal

You could use the Sum function only if the report's record
source query has a calculated field with the number of
records in the group.
 
Back
Top