Solved

Access 2007 Date Query Criteria -6

Posted on 2014-09-10
4
452 Views
Last Modified: 2014-09-10
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
Comment
Question by:CMILLER
  • 2
  • 2
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40315788
select [datefield]
from tablex
where  [datefield] Between Dateadd("yyyy",-6,[Enter Date]) And [Enter Date]
0
 

Author Comment

by:CMILLER
ID: 40315793
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
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40315801
select [datefield]
 from tablex
 where  Year([datefield]) = Year(Dateadd("yyyy",-6,[Enter Date]))
0
 

Author Comment

by:CMILLER
ID: 40315907
Sorry, I had it wrong again.

I posted another question.

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

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question