SUMthing is driving me nuts!!

Awes

Usually Confused
Local time
Today, 04:06
Joined
Aug 20, 2002
Messages
34
Hi Everyone

I am having trouble trying to SUM some values in a report.

I have a table called 'tblPartsUsed' which contains the following fields:

intPartNo
strPartDesc
intQtyUsed
intPriceEach
intInvoiceNo

I then have a query which is based on the value 'intInvoiceNo' from the table above so that I end up with a list of all the parts used that are related to a specific Invoice No.

My report is linked to the above query and has the following bound text boxes which are linked to the query as shown:

Report Query

txtPart strPartDesc
txtQty intQtyUsed
txtPrice intPriceEach (this text box is not visible on the report)
txtCost =[txtQty]*[txtPrice]

So far everything works ok, the problem comes when I try to get a grand total for all the records shown.

I am trying to get the total by using an unbound text box in the report footer as follows:

txtTotal =Sum([txtQty]*[txtPrice])

When I go to Preview view I get two 'Enter Parameter Values' dialog boxes asking me for:

txtPrice and txtQty

If I just press Enter for each nothing is displayed in the footer and if I enter values the result shown does not equate to Price * Qty !!

Any ideas on where I am going wrong and what the solution is.

Many thanks

AWES
 
You need to reference the field names as they appear in the recordsource rather than the control names. Aggregate functions cannot reference control names. So change to:

txtTotal =Sum([Qty]*[Price])

Assuming that Qty and Price are the recordsource fields.
 
Cheers Both

I knew it had to be SUMthing simple!!

It's always the simple things that trip you up and the hardest to see.

Many thanks, I'll now go in search for the next simple problem.

Cheers

AWES.
 

Users who are viewing this thread

Back
Top Bottom