problems with expression

  • Thread starter Thread starter Valerie
  • Start date Start date
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.
 
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!
 
Back
Top