Query to pull past 3 months (1 Viewer)

kidrobot

Registered User.
Local time
Today, 06:34
Joined
Apr 16, 2007
Messages
409
I have a query that I need to always pull data from the newest past 3 months, so if this query were ran today it would take from months 2,3,4 (Feb, Mar, Apr). Any clue on how to do this?
 

rainman89

I cant find the any key..
Local time
Today, 06:34
Joined
Feb 12, 2007
Messages
3,015
between dateadd("m",-3,date()) and date()
 

kidrobot

Registered User.
Local time
Today, 06:34
Joined
Apr 16, 2007
Messages
409
That didn't work. Does any of that above correspond to a column name?
 

rainman89

I cant find the any key..
Local time
Today, 06:34
Joined
Feb 12, 2007
Messages
3,015
it should go in the criteria of your date column
 

kidrobot

Registered User.
Local time
Today, 06:34
Joined
Apr 16, 2007
Messages
409
I'm not sure if my question was clear, but the months are in the table so I only want the months 2, 3, 4. (that is how the months are displayed in the table also, just as numbers)
 

rainman89

I cant find the any key..
Local time
Today, 06:34
Joined
Feb 12, 2007
Messages
3,015
i just created a sample query and put this in and it worked.

Between (DateAdd("m",-3,Date())) And Date()
 

rainman89

I cant find the any key..
Local time
Today, 06:34
Joined
Feb 12, 2007
Messages
3,015
oh.... i see now
then the way i suggested will not work for u
 

rainman89

I cant find the any key..
Local time
Today, 06:34
Joined
Feb 12, 2007
Messages
3,015
yeah. ull need to search on parsing dates to get the month number then base your query upon that
 

boblarson

Smeghead
Local time
Today, 03:34
Joined
Jan 12, 2001
Messages
32,059
Then move to this (a variation on Ray's suggestion):

Between Format(DateAdd("m",-3,Date()),"m") And Format(Date(),"m")
 

kidrobot

Registered User.
Local time
Today, 06:34
Joined
Apr 16, 2007
Messages
409
sweet that works great, for some reason it pulls data from 2,3,4,5. So I just used 2 and it took 2,3,4. Thanks!~
 

kidrobot

Registered User.
Local time
Today, 06:34
Joined
Apr 16, 2007
Messages
409
Sorry but my Manger wants the past 3 months not including the current month.

This Between Format(DateAdd("m",-2,Date()),"m") And Format(Date(),"m") ... works but it takes 3 months plus the current month, any idea on how to skip the current month?
 

boblarson

Smeghead
Local time
Today, 03:34
Joined
Jan 12, 2001
Messages
32,059
Between Format(DateAdd("m",-2,Date()),"m") And Format(DateAdd("m",-1,Date(),"m")
 

kidrobot

Registered User.
Local time
Today, 06:34
Joined
Apr 16, 2007
Messages
409
wow you're amazing... i gave you positive replutation points
 

Users who are viewing this thread

Top Bottom