View Full Version : date search


berniez
04-20-2009, 08:23 PM
Hi, I have been seraching for a while now and cant find an answer I am using access 2007 and have a date field called renewal_date I need to print all records between week 4 and week 5 from the current date. I have tried and cant seem to get it right for the query syntax. Can some one please help.

pbaldy
04-20-2009, 09:14 PM
You want to use the Between operator with the DateAdd() function. Look in help at those and see what you come up with.

raskew
04-20-2009, 09:21 PM
Hi -

Welcome to the forum.

I'm very dubious about week numbers as an accurate indicator. They are going to vary from day to day.
Having said that, here's something you can play with:

SELECT tblTransfer.*
FROM tblTransfer
WHERE (((tblTransfer.ExpDte) Between DateAdd("ww",-5,Date()) And DateAdd("ww",-4,Date())));

Modify with your table/field names.

Today being #4/21/09# -- here are the parameters you're looking at -- from the debug window:

? dateadd("ww", -5, date())
3/17/2009
? dateadd("ww", -4, date())
3/24/2009

Please post back with your results.

Best wishes - Bob