Just as you surrounded your date with # delimiters (and had it in mm/dd/yyyy
format), so too must you do that with the value you're passing from your
variable:
Dcount("*", "tblWR", "Created >= " & Format(dtmRequestLimitDate,
"\#mm\/dd\/yyyy\#"))
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Paco" <(E-Mail Removed)> wrote in message
news:4F6DFF30-D1FC-42D6-A9ED-(E-Mail Removed)...
> Any idea why these two dcounts return different values?
>
> Dcount("*", "tblWR", "Created >= #4/29/2006#") (This returns the correct
> count)
> Dcount("*", "tblWR", "Created >= " & dtmRequestLimitDate) (This returns a
> count of all records)
>
> dtmRequestLimitDate is a public date variable that is set to Date(). It
> shows the correct value when the code is run. I have a feeling there is
> something about the syntax using a variable that I'm not seeing.
>
> Thanks.