View Full Version : **DSum - Date Criteria problem**


John M
06-04-2002, 12:44 PM
Anyone!

How does the date criteria work for the DSum function?? I can't get it to Sum using the following methods. Thanks in advance.

First Method:
sSQL1 = "[ReturnDate] = #" & Format(Text31, "dd/mm/yyyy") & "#"
nRevenue = DSum("[LateCharge]", "tblHireTransaction", sSQL1)

Second Method:
sSQL1 = "[ReturnDate] = #" & Format(Text31, "dd/mm/yy") & "#"
nRevenue = DSum("[LateCharge]", "tblHireTransaction", sSQL1)

[ReturnDate] is of Date/Time data type. Text31 is an unbound field on my form with format "short date" and default "=Date()".

Pat Hartman
06-04-2002, 05:05 PM
To make this work, you're going to have to format the date string in the US format of mm/dd/yyyy or use a format that uses a text value for month such as dd/mmm/yyyy.

John M
06-09-2002, 08:20 AM
Thanks Pat,

You've solved the problem again. Many thanks.