Solved: Access 2007 Future Date Query

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

joebell

Thread Starter
Joined
Sep 9, 2009
Messages
2
Hi Everyone,
I am trying to create a query that selects all records with a future date. The table that I am trying to select the records from is named "Events" and the field containing the date is "Date"
I am using Access 2007 and the date field is formated as 'Date/Time' data. I tried multiples ways, and even tried the 1000 year add date function pasted in below. Does anyone have any insights--I'm sure its something that is quite simple.

Thanks,
Joe

SELECT Events.Date, Events.Event
FROM Events
WHERE (((Events.Date)=DateAdd("yyyy",1000,Now())));
 
Joined
Aug 28, 2009
Messages
115
Hi Joebell,

Try using Date() instead of Now(). As I know of Now() returns not only the computer's system/current date but also the computer's system/current time. This could be the problem.

Best,
Zhouma
 

OBP

Joined
Mar 8, 2005
Messages
19,896
Do you want the records from a single date to be returned or a range of dates?
If it is a range of dates use the Between dateone and datetwo function.
i.e. Between Date() and Date() + 365 gives the all the records between today and one years time.
If it is a single Date then use Date() + noofdays
i.e. Date() + 365 gives the date one year from now.
 

joebell

Thread Starter
Joined
Sep 9, 2009
Messages
2
Hi Zhouma,
I switched 'now' to 'date' and it works! Thanks for your help. OBP: I was just trying to get records with a future date. I'll paste the working code below.

Joe


SELECT Events.Date, Events.Event, DateAdd("yyyy",1000,Date()) AS Expr1
FROM Events;
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top