Summing a text box on a report

D

Dave

I am trying to creating a cross tab report with price and quantity.

Both price and quantity are read directly from the database. And I can show
the extended price on the report by adding a textbox called txtExtPrice
with the control source as "=[txtQuantity]*[txtPrice]".

But I cannot sum the extended price in the footer as "=sum([txtExtPrice])"
or as "=sum([txtQuantity]*[txtPrice])"

How do I create an aggregate of a computed value on a report?
 
A

Arvin Meyer [MVP]

Your expressions are correct for what you are trying to do. What is showing
up in the text box when you run the report? Are there any error messages? Do
any of the line items result in an error? or in an empty text box?
 
D

Dave

Thanks Arvin

I am prompted to "Enter Parameter Value" for the name of the control I am
trying to sum (i.e., =sum([txtExtPrice]))

There is a textbox of this name (txtExtPrice) in the Detail section of the
report. Its control source is a computed value; the product of txtQuantity
and txtPrice. I have double checked to ensure I am referencing the correct
name of the control in my sum function.

The txtSumExtPrice is in the footer section of the report. The problem
must have something to do with summing an aggregate because there is
another textbox in the footer whose control source is "quantity" which is a
field value rather than a calculated value and it sums properly.

Thanks for your help. I will continue to look at this.


Arvin Meyer said:
Your expressions are correct for what you are trying to do. What is
showing up in the text box when you run the report? Are there any error
messages? Do any of the line items result in an error? or in an empty text
box?
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Dave said:
I am trying to creating a cross tab report with price and quantity.

Both price and quantity are read directly from the database. And I can
show the extended price on the report by adding a textbox called
txtExtPrice with the control source as "=[txtQuantity]*[txtPrice]".

But I cannot sum the extended price in the footer as
"=sum([txtExtPrice])" or as "=sum([txtQuantity]*[txtPrice])"

How do I create an aggregate of a computed value on a report?
 
J

John W. Vinson

Thanks Arvin

I am prompted to "Enter Parameter Value" for the name of the control I am
trying to sum (i.e., =sum([txtExtPrice]))

There is a textbox of this name (txtExtPrice) in the Detail section of the
report. Its control source is a computed value; the product of txtQuantity
and txtPrice. I have double checked to ensure I am referencing the correct
name of the control in my sum function.

You can sum a *field in the report's recordsource* - but you cannot sum a
*control on the report*.

If (as I'm guessing) txtExtPrice has an expression as its control source, move
the expression into the report's Query as a calculated field, and sum that.
 

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