Total value for order

  • Thread starter Thread starter lunde
  • Start date Start date
L

lunde

I have a query where I extract a line per order_line. One of the fields
is products_price, but as there can be several lines for a given order,
and I need to set a flag if the total products_price per order is below
a certain limit, I do not know how to add the products_price per line
into a total. It would be o.k. to duplicate the total for each line in
the output.

Mogens
 
A DSUM could do the job, but that depends on the context where you need that
sum, in the end.



DSUM( "product_price", "tableNameHere", "orderID = " & orderID )



should sum the product_price for the given orderID value, a number. If the
orderID is a string, rather than a number:


DSUM( "product_price", "tableNameHere", "orderID = '" & orderID &
"'" )

or, better,


DSUM( "product_price", "tableNameHere", "orderID = " &
FORMS!formNameHere!orderIDcontrolNameHere )



if the orderID is available from a control in an open FORM.


The first argument CAN be the string of an expression too:

DSUM( " unit_price * quantity " , ..., ... _




Vanderghast, Access MVP
 
Back
Top