Trying to sum numberic values in the footer of a continuous form

SteveL13
SteveL13 used Ask the Experts™
on
I have a continuous form, which is actually a sub-form on a main form, with a numeric field in the detail.  Then in the footer I'm trying to sum those values.  

The field name in the detail is a calculated number named txtAmount

Then in the footer I have:

=Sum([txtAmount])

Isn't working.  Why?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014

Commented:
Try using the same formula in the Sum method as you're using for the Calculated Field.

Author

Commented:
Isn't working.  Here is the formula I have in the calculated field:

=[txtQuantity]*[txtRate]

When I copy/paste that into the control for the field in the footer I get just the value of the calculated field in the first record on the continuous form.
Most Valuable Expert 2012
Top Expert 2014

Commented:
Are you doing this in the Footer of the Subform?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Yes.
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Try with either:

    =Sum([txtQuantity]*[txtRate])

or:

    =Sum([Quantity]*[Rate])

if Quantity and Rate are the names of the fields of the recordsource.

/gustav

Author

Commented:
Neither worked.
Most Valuable Expert 2012
Top Expert 2014
Commented:
Is the Calculated Field in the Query? You might try doing your calculation there, and then SUM the field from the Query.
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
Then, I guess, the footer is on the main form. If so, you will have to refer to the controls on the subform.

/gustav
MIS Liason
Most Valuable Expert 2012
Commented:
You never clearly states what "Footer" you were referring to...
In any event, ...You cannot sum a "Control" (txtAmount)
...you must sum the "Field" (Amount)

So as Scott suggests, ...make the calculation a field in the query, then you can sum it pretty much wherever you like.
sums galoresimple sample attached

JeffCoachman
Database80.mdb

Author

Commented:
All helped.  Thanks.
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
You are welcome!

/gustav
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
;-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial