Could someone provide me with an expression that would always return data from last week? I've been playing around with serialdate and datepart but can't quite figure it out.
Place this in the criteria cell of your date field (assuming it's in date/time data format). Your query will then return only those records between Sunday of the preceding week and Saturday of the preceding week. Should work regardless of whether the field includes time.
Code:
>= date()-weekday(date())-6 AND <date()-weekday(date())+1
The fact that you asked that question means that you did not analyse Bob's answer so that you understood it, it is no use just copying solutions you must understand them to progress.
Feel I might have been a bit harsh there, having a bad day with another poster.
Ok Bob's formulae works as workday returns 1-7 for Sunday to Saturday once you step outside this comfort zone a simple formulae wont work, infact a function is the only way I can think of, which is why I asked for clarification of requirements earlier.
For Blukes needs, Mon-Sun, Sundays value must be 8 and the fixed parts -5 and +2.
If you need help with the function come back.
With the formula just quoted if we take say Mon 14th Jan he requires Mon7th to Sun 13
>=date()-weekday(date())-5 AND <date()-weekday(date())+2
gives 14-2-5 and 14-2+2 = 7th to 14 which is correct but if its Sunday 13th
he requires 31st Dec to 5th Jan but gets
gives13-1-5 to 13-1+2 = 7th to 14th
if Sunady is 8
13-8-5=0 ie 31st Dec 13-8+2 =7th which is what the formula requires.