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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return Records for last 5 years 1

Status
Not open for further replies.

Lavenderchan

Technical User
Jul 21, 2008
132
US
Hello,

I am trying to return records for the last five years with out using specific dates. I have figured out how to return one year by using the formula
Code:
 Year(Date)))
. I can also return records by from 5 years using
Code:
Year(Date))-5
. However its only returning records for that specific year. How do I combine them using Between And. What I have used is not working.

 
Last 5 years could be all of 2015 to today:
[pre] Year([YourDateField])>= Year(Date())-5[/pre]

If you want the equivalent of 5 years based on the current date:
[pre] [YourDateField] > DateAdd("yyyy",-5,Date())[/pre]

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top