Results 1 to 6 of 6
  1. #1
    Paul-NY is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    7

    query criteria for current date

    Hi
    I am in Access Query Design view creating a query that retrieves records that are greater than the curernt date.

    In the date database field, I am putting the one of the following:

    > Date()

    or

    > Now()



    Neither of these is returning records that are greater than the current date. Anyone have any ideas?

    Paul

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Where exactly are you putting it? The first should work in the criteria row under your date field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Paul-NY is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    7

    query criteria for current date

    That is exactly where it is going--see screenshot below, but it retrieves everything when it should not return anything.

    Paul

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    The criteria on the second line on the LocationCode field is an "OR". If you look at the SQL, you're basically saying

    WHERE (A And B And C) OR D

    So anything with a LocationCode of L03 will be returned, regardless of date or type code. If you want the date and TypeCode criteria applied to that Location code, you need them on the second line as well.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Paul-NY is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    7

    query criteria for current date

    That did it, thank you very much..

    Paul

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    No problem; us Paul's have to stick together!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. SQL Inner Join where date = current date
    By Tyork in forum Queries
    Replies: 2
    Last Post: 11-07-2010, 02:07 PM
  2. Query Date Criteria
    By svanicek in forum Access
    Replies: 1
    Last Post: 07-09-2010, 11:13 AM
  3. Comparing Date with current Date
    By ds_8805 in forum Forms
    Replies: 7
    Last Post: 03-31-2010, 09:31 PM
  4. Query criteria, add 5 months to date
    By thart21 in forum Queries
    Replies: 1
    Last Post: 03-29-2010, 05:09 PM
  5. Replies: 9
    Last Post: 03-19-2010, 10:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums