Dsum for the current month sales

AlefAelol

Registered User.
Local time
Today, 22:26
Joined
May 21, 2014
Messages
75
Hi Everybody,
I'm using the following expression to find the sum of the current month sales.
Code:
=DSum("[Price]*[Quantity]","QueryCurrentMonth Sales","[ORDDate]=Month (now())")

However, it returns no result. Can anyone help please. Thank you.
Note: the above expression is located on the control source of an ab textbox. Moreover, it works well when i try the following expression

Code:
=DSum("[Price]*[Quantity]","QueryCurrentMonth Sales","[ORDDate]=[ORDDate]")
It returns the sum of all sales.
 
ORDDate is presumably a date whilst Month (now()) returns a number between 1 and 12 so your comparison is

10/05/2014=5

which it clearly doesn't

try

month(ORDDate])=Month (now())

however this will return last years data as well so I suspect you actually need

month(ORDDate])=Month (now()) AND year([ORDDate])=year(now())

Final note, now() returns the current date and time which in this sceanrio doesn't actually matter but going forward better to use the right functions - in this case Date() rather than now(). For example if datefield is a date then

datefield=Now() will return false because of the time element in Now()
 

Users who are viewing this thread

Back
Top Bottom