• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 469
  • Last Modified:

Access 2007 Date Query Criteria -6

I need help with a query on one of my tables. On one of the table fields there is a date mm/dd/yyyy. I need to have the user input a future date and then count back 6 years from the table field date. I only want to see the dates that fall in the 6 year window.

ex: user input - 01/01/2015

the query would pull only the dates starting 01/01/2009 to 01/01/2015
0
CMILLER
Asked:
CMILLER
  • 2
  • 2
1 Solution
 
Rey Obrero (Capricorn1)Commented:
select [datefield]
from tablex
where  [datefield] Between Dateadd("yyyy",-6,[Enter Date]) And [Enter Date]
0
 
CMILLERAuthor Commented:
Sorry, I just realized that I posted the query wrong.

ex: user input - 01/01/2015

 the query would pull only the dates that are in the 6th year, which would be all of 2009
0
 
Rey Obrero (Capricorn1)Commented:
select [datefield]
 from tablex
 where  Year([datefield]) = Year(Dateadd("yyyy",-6,[Enter Date]))
0
 
CMILLERAuthor Commented:
Sorry, I had it wrong again.

I posted another question.

http://www.experts-exchange.com/Database/MS_Access/Q_28515939.html
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now