Dsum Date criteria

haroon.mansha

Registered User.
Local time
Tomorrow, 02:16
Joined
Jun 6, 2013
Messages
106
Hi All
I have a form with subform . I want to calculate purchase quantity with criteria of product and quanties before sale date. If i use with specified date it gives correct result.but if i use field address it ignores date criteria

Nz (dsum ("pqty","purchasequery","product=" & [sales.product] & "and clerancedate<=#31/07/2014#"),0)

Nz (dsum ("pqty","purchasequery","product=" & [sales.product] & "and clerancedate<=#" & [forms!salesm!sdate] & "#"),0)
But it is not working

Sdate is date and it is on main form
 
If you say the first is working, then try:
Code:
Nz (dsum ("pqty","purchasequery","product=" & [sales.product] &  " and clerancedate<=#" & forms!salesm!sdate & "#"),0)
Or
Code:
Nz (dsum ("pqty","purchasequery","product=" & [sales.product] &  " and clerancedate<=#" & forms!salesm.Form!sdate & "#"),0)
 
Thanks for helping. Infact it is not giving error but it is not showing correct result. It is returning 0
 
Infact it is not summing at all. Means last expression I used ignoring date criteria but it was giving sum. While now it is giving 0. While it should give result 10 according to data I used
 
If I used first impression with date written it was working fine
 
Okay, then try:
Code:
Nz (dsum ("pqty","purchasequery","product=" & [sales.product] &  " and clerancedate<=#" & Format([forms!salesm!sdate],"mm/dd/yyyy") & "#"),0)
 

Users who are viewing this thread

Back
Top Bottom