Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last 6 months query

Status
Not open for further replies.

Deano1976

Technical User
Dec 16, 2004
41
GB
How can I get access to show records for the last 6 full months of a date/time field.
 
Take a look at the DateAdd function. i.e. WHERE myDate BETWEEN Date() And DateAdd("m", -6, Date).

HTH,

Ken S.
 
I have investigated this, but the nearest I can get is 6 months back from todays exact date and time. I need the full month, 6 months ago and onwards to the last full month.
 
A look at the DateSerial function may also be of interest.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
OK I'm getting there now, but one problem still exists. The six months goes back ot the previous year (2004) and so I am getting information back for April 2004 as well as April 2005. How can I get Access to take 6 months of and take into consideration the year?
 
Have you read my previous post ?
What about something like this ?
DateSerial(Year(Date), Month(Date)-6, 1)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PH (I didn't initially read yours in time).

This works perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top