How to SUM both the main and subreports ?

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hello,

I want to sum up two fields of a report : one from the main report while the
other from the subreport.

That is the formulae of the "Total" field : =Sum([tx_amt]+[daily_salary
subreport].Report!daily_bonus)

I don't understand why Sum([tx_amt] is 19600 and [daily_salary
subreport].Report!daily_bonus) is 5000, so the "Total" should be : 24600,
but the displayed value was : 19604 because there were 4 records in the main
report.
 
John said:
I want to sum up two fields of a report : one from the main report while the
other from the subreport.

That is the formulae of the "Total" field : =Sum([tx_amt]+[daily_salary
subreport].Report!daily_bonus)

I don't understand why Sum([tx_amt] is 19600 and [daily_salary
subreport].Report!daily_bonus) is 5000, so the "Total" should be : 24600,
but the displayed value was : 19604 because there were 4 records in the main
report.


You can not sum anything except ***fields*** in a report's
record source table/query.

The main report's footer text box can sum the amt field in
the main report with a simple Sum(tx_amt)

Similarly, the subreport can sum it's bonus field in its own
footer by using a text box (named txtTotalBonus) and the
expression =Sum(daily_bonus)

If the subreport appears in the main report's footer
section, you can get the total you want with the expression:

=Sum(tx_amt) + [daily_salary subreport].Report!txtTotalBonus

If you have the subreport in the main report's detail
section or in a group header/footer section, you can use the
RunningSum property to accumulate the values from multiple
instances of the subreport.
 
Back
Top