Adding quantity x cost for entire report.

C

cdesio

I have a report which has 2 values, quantity and cost and I need to get the
total for all rows returned.
I was able to get the total for each row to return a total but I can't get an
over all total.

Any ideas?

Example:

Item Quantity Cost Total
Penlights 2 $4.00 = $8
O2 Maks 4 $6.00 = $24
 
A

Arvin Meyer [MVP]

Add a report footer. Add a text box to the footer and set it's controlsource
to sum your total controls:

=Sum([Total])

Assuming that Total is the actual name of the text box used to show the
product of Quantity and Cost.
 
M

Marshall Barton

cdesio said:
I have a report which has 2 values, quantity and cost and I need to get the
total for all rows returned.
I was able to get the total for each row to return a total but I can't get an
over all total.

Any ideas?

Example:

Item Quantity Cost Total
Penlights 2 $4.00 = $8
O2 Maks 4 $6.00 = $24


You can Sum a text box, so the footer grand total text box
expression should be:

=Sum(Quantity * Cost)

If, for some reason, you can't do that, then use a running
sum text box.
 
C

cdesio

Arvin,

I have a text box called Item_Total with a control source of =Nz([Quantity],0)
*Nz([Cost],0)

When I put =Sum([Item_Total]) on the report footer it prompts me for the
value of [Item_Total]
Add a report footer. Add a text box to the footer and set it's controlsource
to sum your total controls:

=Sum([Total])

Assuming that Total is the actual name of the text box used to show the
product of Quantity and Cost.
I have a report which has 2 values, quantity and cost and I need to get the
total for all rows returned.
[quoted text clipped - 11 lines]
 
C

cdesio

The problem with =Sum(Quantity * Cost) is it will add all the quantity and *
that by all the costs.

So instead of $32 I get 6x$10 = $60.

Marshall said:
I have a report which has 2 values, quantity and cost and I need to get the
total for all rows returned.
[quoted text clipped - 10 lines]
You can Sum a text box, so the footer grand total text box
expression should be:

=Sum(Quantity * Cost)

If, for some reason, you can't do that, then use a running
sum text box.
 
J

John W. Vinson

I have a report which has 2 values, quantity and cost and I need to get the
total for all rows returned.
I was able to get the total for each row to return a total but I can't get an
over all total.

Any ideas?

Example:

Item Quantity Cost Total
Penlights 2 $4.00 = $8
O2 Maks 4 $6.00 = $24

The problem is that you can sum a field - but you can't sum a textbox!

Rather than calculating the total in a textbox on the report, calculate it in
the Report's recordsource query as a calculated field. Open the query in
design view and type

Total: [Quantity] * [Cost]

in a vacant Field cell. You can then use

=Sum([Total]) in the footer.
 
C

cdesio

That did the trick! Thanks John!!
I have a report which has 2 values, quantity and cost and I need to get the
total for all rows returned.
[quoted text clipped - 10 lines]
The problem is that you can sum a field - but you can't sum a textbox!

Rather than calculating the total in a textbox on the report, calculate it in
the Report's recordsource query as a calculated field. Open the query in
design view and type

Total: [Quantity] * [Cost]

in a vacant Field cell. You can then use

=Sum([Total]) in the footer.
 
A

Arvin Meyer [MVP]

It didn't understand the Name properly. I'm glad John's post cleared that up
for you.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


cdesio said:
Arvin,

I have a text box called Item_Total with a control source of
=Nz([Quantity],0)
*Nz([Cost],0)

When I put =Sum([Item_Total]) on the report footer it prompts me for the
value of [Item_Total]
Add a report footer. Add a text box to the footer and set it's
controlsource
to sum your total controls:

=Sum([Total])

Assuming that Total is the actual name of the text box used to show the
product of Quantity and Cost.
I have a report which has 2 values, quantity and cost and I need to get
the
total for all rows returned.
[quoted text clipped - 11 lines]
 
M

Marshall Barton

No, it won't do that. If that were what you wanted, I would
have written:
=Sum(Quantity) * Sum(Cost)
but I wrote:
=Sum(Quantity * Cost)
which is equivalent to what John said about doing the
multiply in the query.
--
Marsh
MVP [MS Access]
The problem with =Sum(Quantity * Cost) is it will add all the quantity and *
that by all the costs.

So instead of $32 I get 6x$10 = $60.

Marshall said:
I have a report which has 2 values, quantity and cost and I need to get the
total for all rows returned.
[quoted text clipped - 10 lines]
You can Sum a text box, so the footer grand total text box
expression should be:

=Sum(Quantity * Cost)

If, for some reason, you can't do that, then use a running
sum text box.
 

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