Results 1 to 4 of 4
  1. #1
    skifreak is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    6

    get last 5 days of data

    I want to do the following in Access. This did not work



    SELECT *FROM [mytable]WHERE (DATEDIFF(day, [date_field], GETDATE()) < 5)

  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,652
    The equivalent of GETDATE() in Access is Now().
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    skifreak is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    6
    This did not work. It is asking me for the 'Day' parameter.

    SELECT * FROM [billing]WHERE (DATEDIFF(day, [Date Request Received], now()) < 5)

  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,652
    Sorry, missed that. In Access replace day with "d". You can find the syntax in help.
    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. Dates before 30 days
    By fabiobarreto10 in forum Queries
    Replies: 7
    Last Post: 04-20-2012, 12:11 PM
  2. Only Show Last 7 Days of data
    By MFS in forum Queries
    Replies: 8
    Last Post: 04-05-2012, 01:25 PM
  3. Select Dates between days and two days ago?
    By rstonehouse in forum Queries
    Replies: 4
    Last Post: 08-18-2010, 02:13 AM
  4. Help with SQL: Birthdays in Next 30 days
    By kaylachris in forum Queries
    Replies: 1
    Last Post: 06-21-2010, 05:24 PM
  5. less than 180 days old
    By techexpressinc in forum Queries
    Replies: 2
    Last Post: 06-04-2009, 04:29 PM

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