Your values probably have time in them as well as the date (are you using
the Now() function to populate them?) Date/Time values are stored as 8 byte
floating point numbers, where the integer part represents the date as the
number of days relative to 30 Dec, 1899, and the decimal part represents the
time as a fraction of a day. If all you specific is a date, it's assumed to
be midnight of that day, and any records for that day which include a time
will be greater than just the date.
You can use the DateValue function to remove the time from your values, or
you can just use one day higher in your comparison.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
"nectar" <me*********@dbforums.com> wrote in message
news:33****************@dbforums.com...
Hello
In VBA I need to count records from an Offers table, that were created
beetwen 2 dates (strDate1 and strDate2).
Using the DCount as follow gives me strange results: records that were
created ON strDate1 are taken in account while records that were created
ON strDate2 are not. Records that were created before strDate2 are taken
in account.
In others words, it works fine unless that it doesn't take the = part of
the second operator.
DCount("*", "Offers", "([OfferDate] >= #" & strDate1 & "#) AND (#" &
strDate2 & "# >= [OfferDate])")
Any idea? Thanks in advance!
nectar
--
Posted via http://dbforums.com