expression query 3 calculated dates? (1 Viewer)

Clayhead22

Registered User.
Local time
Today, 00:00
Joined
Feb 22, 2015
Messages
36
Hi. I really need some help for something i am building.

I have a query in Access that runs however their are a lot of records.

What i want to do is have the criteria for Date to pull back the follow records

Current Day
Yesterday
7 Days ago
8 Days ago
14 Days ago
15 Days ago

Can anyone please help with this i have been stuck for hours?
 

Minty

AWF VIP
Local time
Today, 00:00
Joined
Jul 26, 2013
Messages
10,371
What have you tried ?

Today's date is returned by using = Date() in the criteria. Yesterday would be =Date()-1 etc.

If your field name is called Date please change it, as you can see Date is a reserved word in access and will cause no end of problems going forwards.
 

Clayhead22

Registered User.
Local time
Today, 00:00
Joined
Feb 22, 2015
Messages
36
I managed to get today and yesterday with

>=DateAdd("d",-1,Date())

however regardless of the mixture of things i try a can not add the rest f the dates. Im a total amateur at this.

you mean like adding this to the end?

& Date()-7 & Date()-8 & Date()-14 & Date()-15

Also the column label is PeriodDate.
 
Last edited:

Minty

AWF VIP
Local time
Today, 00:00
Joined
Jul 26, 2013
Messages
10,371
You only need >= Date() -15 to get everything from up to fifteen days ago.
 

Clayhead22

Registered User.
Local time
Today, 00:00
Joined
Feb 22, 2015
Messages
36
Yep thought of that one but each day is around 200k records so exporting to excel is not possible.
 

Minty

AWF VIP
Local time
Today, 00:00
Joined
Jul 26, 2013
Messages
10,371
So you only want the specific days, not everything in between?

Then you need >= date()-1 or = date() -7 or =date()-8 or = date()-14 or = Date()-15
 

Users who are viewing this thread

Top Bottom