Reputation: 363
Im starting to pull my hair out.
I am looking to do a multi criteria dsum that looks at the current user and todays date.
Tried many variations but must be missing something very simple so any help is appreciated
StatusBox = DSum("[Task_time]", "[tbl_Data]", "[CDP] = '" & Environ("username") & "' and [Record_Date] = '" & Date & "'")
Upvotes: 0
Views: 103
Reputation: 55816
You are just making it slightly too complicated:
StatusBox = DSum("[Task_time]", "[tbl_Data]", "[CDP] = '" & Environ("username") & "' And [Record_Date] = Date()")
Upvotes: 1
Reputation: 8518
Dates must be enclosed with #
. Also they need to be formatted in order to return the desired result.
Try this:
StatusBox = DSum("[Task_time]", "[tbl_Data]", "[CDP] = '" & Environ("username") & "' and [Record_Date] = #" & Format(Date, "mm/dd/yyyy") & "#")
Upvotes: 1