Tech Support Guy banner
Status
Not open for further replies.
1 - 5 of 5 Posts

·
Registered
Joined
·
2 Posts
Discussion Starter · #1 ·
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())));
 

·
Registered
Joined
·
115 Posts
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
 

·
Registered
Joined
·
19,896 Posts
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.
 

·
Registered
Joined
·
2 Posts
Discussion Starter · #4 ·
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;
 
1 - 5 of 5 Posts
Status
Not open for further replies.
Top