Thursday, January 27, 2005

Selecting a date range in Microsoft Access

I needed to select dates that fell within a range today and today - 30 days using Microsoft Access.

Initial questioning made me think I could make use of mysql type dates like
"2004-01-27". No such luck so looking for a good function I found that Now() like in most DBMS provides a current timestamp. I later discovered that Microsoft Access treats this object special and as such you can perform calculations on Now().

The simple little query that I used consisted of the following:

Select Username, Lastupdate from Employee where
Lastupdate Between Now() and Now()-30;

References: www.microsoft-accesssolutions.co.uk/select_birthday.htm

0 Comments:

Post a Comment

<< Home