what is wrong with dsum function

water911

New Member
Joined
Mar 30, 2009
Messages
9
Dear
i am trying to make dsum function read from different filed which is (date) but it is not working ,
please advise


D2 = DSum("Qty", "AllD", " [M]=[M1] ")
where [M1] date can be enter by end user

but if i make date as # 01/01/2009# it does give value

D3 = DSum("Qty", "AllD", " [Grade] = [C1] and [M]= #01/01/2009# ")
 
yes the date is vary from 1st till the end of the month
is the code going to be changed

i test your code it is working when i combine the two code in one it does not work
D1 = DSum("[Qty]", "[AllD]", " [Grade] =[C1]") ok
D2 = DSum("[Qty]", "[AllD]", "[M]=#" & [M2] & "#") ok

D2 = DSum("[Qty]", "[AllD]", "[M]=#" & [M2] & "#" And " [Grade] =[C1]") not working
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I'm afraid I don't understand your last reply. Let me know if the DSUM code shown on the form works for you on your form. If you are also using the DSUM in a report, we would need to change the DSUM slightly. Let me know what you still need.



yes i am using desum in code but as coding VB
 
Upvote 0
The And should be inside the quotes. Your D2 formula would be:

D2 = DSum("[Qty]", "[AllD]", "[M]=#" & [M2] & "# And [Grade] =[C1]")

How is that?
 
Upvote 0
Thank you for introducing me to the DateAdd function. I've never had occasion to use it before. I'm sure it will be helpful to me in the future.

Cheers.
 
Upvote 0
if i select any day of feb 09 not 1st day it will not show any value . which i am not looking for
i want to selce any date in Feb regarding less day i want to see total of Feb 09

i used this code but it does not work do you have any idea

D1 = DSum("[Qty]", "[AllD]", "[M]= DatePart("m",[M1])and [Grade] =[C1]")

since
DatePart("m","1/2/2009") will retune 2 which will be my month
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
 
Upvote 0

Forum statistics

Threads
1,215,012
Messages
6,122,682
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top