Results 1 to 6 of 6
  1. #1
    rafterman550 is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2011
    Posts
    5

    Need sql for this

    Hello as most of you can tell from my two posts i am new to sql and access and i am trying to learn fast.



    i have a piece of code i need help with

    where cms.Date_Rec,cms.Date_Req,cms.Date_ret = [enter date] and now()

    i want to basically return all records for fields

    date_rec, date_req, Date_ret where the date range is [enter date] to current date and system time.

    SELECT * from cms
    where cms.Date_Rec,cms.Date_Req,cms.Date_ret between [enter date] and now();
    order by creator decending;

    dont know abody can help with this it be much appreciated

    Regards

    Daniel

  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,640
    Each field needs the complete criteria, separated by AND or OR as appropriate to your needs:

    ...cms.Date_Req between [enter date] and now() AND cms.Date_ret between [enter date] and now()...
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    rafterman550 is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2011
    Posts
    5
    Ok cool i see ill give it a try

    thankyou for you help

    Regards

  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,640
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    rafterman550 is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2011
    Posts
    5
    Hello pbaldy thank you for you last response,

    could you help me with something else please.

    i want to be able to select Creator,Quote_No,Date_Rec,Date_Req,Date_Ret
    from cms
    where (how do i select a date) date = ? or where date = now()

    i.e. [Enter a date]


    Regards

    Daniel

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    select Creator,Quote_No,Date_Rec,Date_Req,Date_Ret
    from cms
    where Date_Rec Between Between [Enter a Date] And Date()
    Date() refers to Today's Date
    Now() refers to Today's Date and time

    If one of your Date_Rec values is something like Mar 15, 2011 you have to enclose that date in #.
    eg. Between [Enter a date] AND #3/15/2011#
    Last edited by orange; 05-05-2011 at 06:34 AM. Reason: clarity

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

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