Frustrating problem. I'm using Access 2002, so you know.
Table includes a field with date/times in it. For example ...
6/18/05 4:32:55 PM
6/19/05 5:17:12 PM
etc.
When I query this field with the Between...And operator as criteria, the last date of the operator does NOT capture records with the correct date. Apparently, because of the time in the field.
For example, if my criteria against the above data is "Between #6/18/05 And #6/19/05#, only the first record above is selected. If I manually delete the time portion of second record so it is stored only as 6/19/05, then it is included in the query.
I have tried formatting the data as Format([myfield],"short date"), but this creates crazy results - apparently ignoring the year and pulling many incorrect records.
I've also used DateSerial(Year([myfield]),Month([myfield]),Day([myfield])) - which creates a proper date, but the query delivers a data type mismatch error on the between...and criteria.
Anybody have any insight into this? The basic question is, how do I get the between...and operator to be inclusive of the second date when the values being queried include times?
Thanks a million if you can help here!
Table includes a field with date/times in it. For example ...
6/18/05 4:32:55 PM
6/19/05 5:17:12 PM
etc.
When I query this field with the Between...And operator as criteria, the last date of the operator does NOT capture records with the correct date. Apparently, because of the time in the field.
For example, if my criteria against the above data is "Between #6/18/05 And #6/19/05#, only the first record above is selected. If I manually delete the time portion of second record so it is stored only as 6/19/05, then it is included in the query.
I have tried formatting the data as Format([myfield],"short date"), but this creates crazy results - apparently ignoring the year and pulling many incorrect records.
I've also used DateSerial(Year([myfield]),Month([myfield]),Day([myfield])) - which creates a proper date, but the query delivers a data type mismatch error on the between...and criteria.
Anybody have any insight into this? The basic question is, how do I get the between...and operator to be inclusive of the second date when the values being queried include times?
Thanks a million if you can help here!