Chris <co*****@gmail.comwrote in
news:11**********************@x35g2000prf.googlegr oups.com:
I need to find a way to write a query that will return the
date of the Friday of four weeks ago. So, if I use today's
date (7/30), I should be returning 7/6 as 4 weeks ago on
Friday. Any help is appreciated.
Access has powerful date mathematics functions.
DateAdd() does what it says, adds a number of periods e.g. days,
weeks months, to a date, or substracts them
Weekday() returns a number from 1 to 7, from Sunday to Saturday.
First we need next Friday:
Dateadd("d", 7- weekday(date(),vbSaturday ),date())
Then we subtract 4 or 5 weeks:(not sure if you mean 4 weeks ago
from last or next friday.
DateAdd("ww",-4, Dateadd("d", 7- weekday(date(),vbSaturday
),date()))
Paste that in the field row of the query designer, change the
expr1: to a meaningful name, and test it.
--
Bob Quintal
PA is y I've altered my email address.
--
Posted via a free Usenet account from
http://www.teranews.com