Date Difference (1 Viewer)

jdraw

Super Moderator
Staff member
Local time
Today, 09:14
Joined
Jan 23, 2006
Messages
15,361
In SQL generally

Code:
where  YourDateToBeChecked Between Date1 and Date2
 

MarkK

bit cruncher
Local time
Today, 06:14
Joined
Mar 17, 2004
Messages
8,178
To test if d1 is between d2 and d3 in VBA you need an expression like...
Code:
d1 > d2 And d1 < d3
Mark
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 08:14
Joined
Feb 28, 2001
Messages
26,998
And depending on whether your range is INCLUSIVE or EXCLUSIVE, you might need

d1 >= d2 and d1 <= d3 (double-ended inclusive).

A word of warning: date fields, depending on how they were stored, MIGHT include times as well as the date part, and might make you wonder why two dates that print as the same date are nonetheless not equal. The answer would be that if raw date fields were stored using the Now() function to supply the timestamp, they WILL include times. Whereas if you used the Date() function to supply the datestamp, they will not.

I don't want to confuse you further unless you need more information on dates and times in Access.
 

Users who are viewing this thread

Top Bottom