Excel
(1)
Report
(1)
XTab
(1)
TxtA
(1)
Withnumeric
(1)
Samepoint
(1)
Times
(1)
Day
(1)

Summing a column in a report

Asked By cinnie
20-Mar-10 09:37 AM
My report has a column of numbers.  Below the column, I would like to show a
text box with the sum of these numbers.  In Excel I would just use something
like "= Sum(C3:C56)", but I do not know how to do this in Access.  My real
problem is that each report has a different number of rows.  Any clues??
Thanks
--
cinnie

cinnie,If you had an uncalculated bound text control named Price, withnumeric

Al Campagna replied to cinnie
20-Mar-10 09:51 AM
cinnie,
If you had an uncalculated bound text control named Price, with
numeric values...
= Sum(Price)
would yield the Sum of Price in any Group Footer, or Report Footer.
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

Use the report footer or a group footer (report footer if you want to sum

John Spencer replied to cinnie
20-Mar-10 09:58 AM
Use the report footer or a group footer (report footer if you want to sum the
entire report and group footer if you want to subtotal by groups of records)
and add a control to the footer with its control source set to sum the
relevant field.  Something Like

ControlSource: =Sum([Amount])



John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

thanks Al and John.

cinnie replied to Al Campagna
20-Mar-10 10:56 AM
thanks Al and John.  I think the reason Control Source:  = Sum([txtA])
does not work is that txtA is from a XTab query.  It is calculated based on a
Count.  Does that mean I cannot use 'Sum([txtA])' to sum these values?  thanks
again
--
cinnie
You can Sum() numeric values from crosstab or other queries.
Duane Hookom replied to cinnie
20-Mar-10 11:17 AM
You can Sum() numeric values from crosstab or other queries. Make sure you
are not attempting to sum in the Page Footer section.

I am confused why you would name a column/field "txtA" when "txt" is
generally a prefix for either a text box or a field/variable storing a
text/string value.

If it is a text box, you cannot Sum() a control.

--
Duane Hookom
MS Access MVP
cinnie wrote:Be careful here.
Marshall Barton replied to cinnie
20-Mar-10 12:38 PM
Be careful here.  The word "field" and the word "control"
mean two different things.  This  is one of those times when
the difference between a control bound to a field and a
record source field is very important.

When using an aggregate function (Count, Sum, etc), you must
use FIELDs from the report's record source table/query.  You
can not use a control on the report.

--
Marsh
MVP [MS Access]
Yes, that was it!
cinnie replied to Marshall Barton
20-Mar-10 07:39 PM
Yes, that was it!  What I had already done was consistent with the good
advice from all of the experts that replied.  But still nothing worked.  You
identified the key point - that the numbers being summed were derived from an
aggregate function, so the underlying query's field had to be used, not the
report's control.  Thanks for a great insight.
--
cinnie
cinnie wrote:You're welcome, but I see that Duane was making the samepoint
Marshall Barton replied to cinnie
21-Mar-10 09:59 AM
You're welcome, but I see that Duane was making the same
point earlier.

--
Marsh
MVP [MS Access]
Post Question To EggHeadCafe