1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Access 2007 Future Date Query

Discussion in 'Business Applications' started by joebell, Sep 9, 2009.

Thread Status:
Not open for further replies.
Advertisement
  1. joebell

    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())));
     
  2. zhouma

    zhouma

    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
     
  3. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    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.
     
  4. joebell

    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;
     
  5. zhouma

    zhouma

    Joined:
    Aug 28, 2009
    Messages:
    115
    You're welcome Joe:D Glad I was able to help
     
  6. Sponsor

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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/859571

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice