View Full Version : Previous time peroid query


brother
04-22-2009, 11:20 PM
Hi,

I'm using this "current week to date"-query from ajetrumpet's thread: (http://www.access-programmers.co.uk/forums/showthread.php?t=157264)

SELECT Table.DateField
FROM Table
WHERE [Table.DateField] BETWEEN

DateAdd("d", -((Weekday(Date()) - 1)), Date()) AND

Date();

How can I get this SQL statement to go one week back starting with [LastOfDateField]?

Thanks!

raskew
04-23-2009, 02:19 AM
Here's the logic.
Replace date() with your date field

? date()
4/23/2009

? dateadd("d", -7, date())
4/16/2009

HTH - Bob

brother
04-23-2009, 05:17 AM
I'm having trouble setting up the query. In code, how do I get it to gather recordsets between LastOfDateField and one week back? Do I need several queries?

raskew
04-23-2009, 06:46 AM
Hi -

See my post here (http://www.utteraccess.com/forums/showflat.php?Cat=&Board=82&Number=1818401&Zf=&Zw=&Zg=0&Zl=a&Main=1818241&Search=true&where=&Zu=13106&Zd=l&Zn=&Zt=1d2&Zs=&Zy=#Post1818401&Zp=). Suggest you follow the same logic in developing your query.

Bob