Using Dsum()???

sgtblitz

Registered User.
Local time
Today, 02:59
Joined
Feb 28, 2008
Messages
45
Hi there guys, ill keep it short and snappy,

Im trying to use the Dsum() function to add together the "Quantities" of specific products bought in transactions i.e. the total quantity for a product called "red t-shirt" and the total quantity for another product called "blue t-shirt". the following was the code i tried to use but it just adds together all quantities of all products:

DSum("[Quantity]","Query2","[Product Name] =[Product Name]")

Does anyone have any ideas at all please?

Thanks
 
DSum("[Quantity]","Query2","[Product Name]='" & Me![Product Name] & "'")
 
Thanks a lot bob, but the problem im having is that I want it to display each calculated value for each product already when the query is opened without it having to request each time which "product name" i want?
 
I don't understand your request. If you want the calculated values for each product, just use an aggregate query to do so. I think some more explanation as to your exact situation and what it is you are really trying to accomplish (pictures are good) so that we can point you in the right direction.
 
Apologies, ill try and clarify

With the code you have given It requests the product name that you want to find the sum of the quantity for which is not the intended way i would wish it to work Below is some screenshots of how it works currently:

Requesting Dsum() function of product "slowww"
http://img81.imageshack.us/img81/5845/screenshot1ps2.jpg

And then the calculated value for that particular product would be displayed in the "expr" column for ALL products

Dsum() of product "slowww" is shown in all rows for all products
http://img86.imageshack.us/img86/4284/screenshot2wa5.jpg


Now the way I want it to be is to instead of showing the same value generated from the one dsum() for that one product in all rows, instead I would want it to be as if the dsum() function has been done for each "product name" with the value for THAT particular product name displayed in the same row. I hope thats clarified it a bit, any more information please message back

Thanks again :)
 
That is just a simple Grouping query.

1. Start a query just like you did in your example

2. Enter the Product Name field and the Quantity Field.

3. Click the GROUP BY Button (looks like Greek Sigma:
sigma.png
).

4. Leave GROUP BY selected for the product name (under the Total area) and change GROUP BY to SUM under the quantity.
 
Thanks a lot Bob! :D

your a living legend :D

hopefully i wont run into many more problems haha

Take care (and by the way, ive done your ratings :D)
 

Users who are viewing this thread

Back
Top Bottom