Continuous Forms - Sum of Values

A

Alan

I have a continuous sub form that uses a query that totals various aspects of
the business against departments.

I can present each field(cloumn) individually no problems and it displays as
expected.What I would like to do is sum accross columns from the ControlSource
Thus I would like a Textbox in my form to display the Sumof Column A, Column
B and Column C

I have tried seting the control source to =SUM(ColumnA+ColumnB+ColumnC)
which produces an error condition.

Any thoughts would be greatfully appreciated
 
A

Al Campagna

Alan,
You shouldn't be summing the column name, you should be summing the
field in that column.
Given an example like an inventory balance with these 3 example
fields...

PartNo Received Disbursed
123 10
123 5
123 7
123 4

The Received sum would be...
=Sum(Received)
The Disbursed sum would be...
=Sum(Disbursed)
The Balance would be...
=Sum(Received) - Sum(Disbursed)
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
A

Alan

Al

Thanks for the reply. I have tried this, however simply get the #error
returned
I have my dept sale grouped into five depts and on a continuous form thus
is displayed on the main form as
Department Name SalesA SalesB SalesC
Dept1 5 2 4
Dept1 3 4 7
Dept3 1 6 2

Another column in the controlsource is sales D and I would like to display
as above but with sales C being a result of the addition of salesC+ SalesD ??

I hope that makes sense as that does not work for me
Do you have any other suggestions ??

--
Many Thanks

Alan


Al Campagna said:
Alan,
You shouldn't be summing the column name, you should be summing the
field in that column.
Given an example like an inventory balance with these 3 example
fields...

PartNo Received Disbursed
123 10
123 5
123 7
123 4

The Received sum would be...
=Sum(Received)
The Disbursed sum would be...
=Sum(Disbursed)
The Balance would be...
=Sum(Received) - Sum(Disbursed)
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
R

Ryan

In the query that the continuous form is based on, add another field and do
the calcuation there. It would look like this..

Total: SalesC + SalesD

Then just add the field to your continous form. That is the correct way to
add from left to right. If you wanted to total all of SalesA, in your
continuous forms footer, you would put an unbound field, then add this to the
defualt value of that field.

=Sum([SalesA])

This is the correct way to add the values in your columns.
--
Please remember to mark this post as answered if this solves your problem.


Alan said:
Al

Thanks for the reply. I have tried this, however simply get the #error
returned
I have my dept sale grouped into five depts and on a continuous form thus
is displayed on the main form as
Department Name SalesA SalesB SalesC
Dept1 5 2 4
Dept1 3 4 7
Dept3 1 6 2

Another column in the controlsource is sales D and I would like to display
as above but with sales C being a result of the addition of salesC+ SalesD ??

I hope that makes sense as that does not work for me
Do you have any other suggestions ??
 
A

Al Campagna

Alan,
Giving us examples helps a lot. But, if you have trouble with your
code, please include that in your post. (Cut & Paste exactly)

For example, what is the Name of the field that sums SalesA, and what is
the ControlSource.

Are SalesA, B, and C calculated fields on your form?
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


Alan said:
Al

Thanks for the reply. I have tried this, however simply get the #error
returned
I have my dept sale grouped into five depts and on a continuous form thus
is displayed on the main form as
Department Name SalesA SalesB SalesC
Dept1 5 2 4
Dept1 3 4 7
Dept3 1 6 2

Another column in the controlsource is sales D and I would like to display
as above but with sales C being a result of the addition of salesC+ SalesD
??

I hope that makes sense as that does not work for me
Do you have any other suggestions ??
 
A

Alan

Al

Sorry I am using a simple select query as ateh control source for the subform
and then selecting the query values.
I believe Garys post may be the simplest option and have it working

Thanks for all your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top