DCount Error

magster06

Registered User.
Local time
Today, 18:11
Joined
Sep 22, 2012
Messages
235
Hi all,

I have a problem with my DCount criteria.

Code:
intStore = DCount("FDID", "LightDuty", "[Email Sent] = 0" AND "[Drs Excuse Exp] = DateDiff("d",Date(),[Drs Excuse Exp])<=14")"

I am getting an error at the "d"; the error states "Expected: list separator or )". I have tried different ways of wrapping the "d", but with no success.

If I leave out the second part of the criteria, then it works just fine.

Thanks ahead of time!
 
intStore = DCount("FDID", "LightDuty", "[Email Sent] = 0 AND [Drs Excuse Exp] = " & DateDiff("d",Date(),[Drs Excuse Exp]) & "<=14)"
 
Now I get syntax error
 
See if this works instead:
intStore = DCount("FDID", "LightDuty", "[Email Sent] = 0 AND [Drs Excuse Exp] = DateDiff('d',Date(),[Drs Excuse Exp])<=14)"
 
Ok, now it is working. I had to take the last part <=14)" and changed it to this <=14") and that did the trick.

Thanks so much for the help boblarson!!
 
Okay, is this in VBA?

Second, what datatype is [Drs Excuse Exp]?
 
Yes, it is vba.

And the datatype is date.

Then the code should really be:

intStore = DCount("FDID", "LightDuty", "[Email Sent] = 0 AND DateDiff('d',Date(),[Drs Excuse Exp])<=14")
 
Last edited:
Yes, the code is working now. What was hanging the code up was the " was on the outside of the ) and I moved it in and now it works great!

I already "Thanked" your post.

Thanks again!

Until next time, lol!
 

Users who are viewing this thread

Back
Top Bottom