dates in query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I use a message box for the user to enter today's date is there a
calculation/code I can use to show all records for two weeks prior to today's
date?
 
Hi,



DateTimeField BETWEEN Now()-14 AND Now()


should do. Now() returns today+actual time, in days and portion (decimal)
of days since 1899.12.30 (December 30 of year 1899). Subtract 14 (days)
make NOW()-14 two weeks ago.

Date() return today (without time, or, more precisely, at midnight)


DateTimeField BETWEEN Date()-14 AND Date() +1


can be used too. The difference between the two is about the "time" (hour
minute second) being considered, or not. I added 1 to include all today (
Date() + 0.75, as example, is up to 6 PM, today).



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top