query dsum

R

Roy

code quantity quantity Ac
1111 100 100
1112 200 300
1113 50 350

i need to know how can i generate the column "Quantity Ac", in a query

i try with a dsum, just can't get the arguments rigth

thank u
 
A

Allen Browne

If you don't mind the query results being read-only, try typing something
like this into the Field row of your query:
QuantityAc: (SELECT Sum([quantity])
FROM [Table1] AS Dupe
WHERE Dupe.code <= [Table1].code)
Replace the 2 instances of "Table1" with your table name.

If you want to use DSum(), try this:
=DSum("quantity", "Table1", "code <= " &
Code:
)
If code is a Text field, you need extra quotes:
DSum("quantity", "Table1", "code <= """ & [code] & """")
 

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