problems with expression

V

Valerie

I am trying to build an expression that is giving me
fits. Unfortunately, I'm brand new to Access so every
step seems to take hours.

I'm in a query that creates a subform for all the items
purchased on a particular purchase order. So I have the
purchase order with all the supplier details and then the
subform with all the order details. I want to create a
totals box at the bottom of the main form. I was told
yesterday that in order to do that I needed to build the
expression in the subform query, then add it to the
subform footer, then copy it into the main form. But the
expression itself isn't working.

The subform query contains the following fields:
tblPurchaseOrdersSub.PO#
tblPurchaseOrdersSub.Part#
tblParts.Description
tblUnitOfMeasure.UofM
tblPurchaseOrdersSub.QtyReceived
tblParts.Cost
tblPurchaseOrdersSub.Reference
tblPurchaseOrdersSub.BackOrder
Total Price: [tblPurchaseOrdersSub]![QtyReceived]*
[tblParts]![Cost]

The expression I am trying to use is Sum([Total Price])
However, it gives me this error message: "You tried to
execute a query that does not include the specified
expression 'PO#' as part of an aggregate function."

Do I need to include the PO # in the expression so that
it will know to total only the prices for that particular
PO? And if so, how do I write the expression?

Thanks for any help you can provide.
 
J

John Vinson

The expression I am trying to use is Sum([Total Price])
However, it gives me this error message: "You tried to
execute a query that does not include the specified
expression 'PO#' as part of an aggregate function."

You're apparently putting the expression in the Query. This indeed
will not work.

Try putting a textbox on the Subform's Footer, and set its control
source property to

=Sum([Total Price])

I.e. do the calculation on the form itself, rather than making the
query serve double duty!
 

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

Similar Threads

Change Form's Recordsource with SQL Statement? 0
subform problems 2
Expression in Forms 3
Form Problem 1
Subform Totals 4
Form Question 5
Order Totals (From Expression) on summary report 0
Form/Report Relationship 24

Top