sum a calculated field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to sum a calculated field. I have a text box in the report
header and sum([txtEndingBalance]) does nothing but ask for parameter
txtEndingBalance to be populated at run. sum(Ending Balance) does nothing
either accept give me very ridiculous totals.
 
It possible to repeat the calculation in the ControlSource of your text box.
For example if the Control Source of txtEndingBalance is
=[Credit] - [Debit]
then you could use:
=Sum([Credit] - [Debit])

However, a better solution might be to use a query as the source for your
report, and move the calculation into the query. Then you have the field in
the source for the report, so you can sum it. For the example above, you
would type this into the Field row in your query:
EndingBalance: [Credit] - [Debit]

More information on calculated fields:
http://members.iinet.net.au/~allenbrowne/casu-14.html
and on preventing problems with calculated fields:
http://members.iinet.net.au/~allenbrowne/ser-45.html
 
I'm not really clear on the point of summing a beginning balance.

If my bank account has $100 this morning, and $120 tomorrow morning, and $80
the morning after, if I sum the beginning balances, I will have $300 in my
account???

Or is the issue that some of these values are repeating on different lines
of the source query, so they are being counted multiple times?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

seeker53 said:
I have done what you suggested and what I get is very ridiculous figures.
I
have a report that list various insurance carriers and the amount of ar
that
has moved to 120. My textbox on the report takes data from a query which
sums the amounts grouped by insurance. In the detail section each carrier
has a total. When I manual calculate the total I receive around 39,000.
When I put =sum([Begin Balance]) in the report footer that number is in
the
millions. I am getting very frustrated with this report.

Allen Browne said:
It possible to repeat the calculation in the ControlSource of your text
box.
For example if the Control Source of txtEndingBalance is
=[Credit] - [Debit]
then you could use:
=Sum([Credit] - [Debit])

However, a better solution might be to use a query as the source for your
report, and move the calculation into the query. Then you have the field
in
the source for the report, so you can sum it. For the example above, you
would type this into the Field row in your query:
EndingBalance: [Credit] - [Debit]

More information on calculated fields:
http://members.iinet.net.au/~allenbrowne/casu-14.html
and on preventing problems with calculated fields:
http://members.iinet.net.au/~allenbrowne/ser-45.html


seeker53 said:
I am trying to sum a calculated field. I have a text box in the report
header and sum([txtEndingBalance]) does nothing but ask for parameter
txtEndingBalance to be populated at run. sum(Ending Balance) does
nothing
either accept give me very ridiculous totals.
 
Back
Top