Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting Last ?? Days/Weeks/Months

Status
Not open for further replies.

waiting12345

Technical User
Joined
Dec 9, 2005
Messages
9
Location
GB
Hi, I'm not too familiar with access dates. I'm programming in ASP and need to say select records from last 30 days. I'd appreciate it if someone could say how I could do this in sql for the table tbdEvents and the field fldDate.

Also how could I extend this to do last so many weeks and months. Appreciate the help. Cheers
 
if you're passing an sql directly into access then something like:

... where dateValue > now() - 30

for weeks, just so #weeks * 7
for months, you need to use the dateserial, i.e.
... where dateValue > dateserial(year(now()), month(now()) - #months, day(now()))

you get the picture...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top