Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2009
    Posts
    3

    Query to return recently added records using system date

    Hi,



    I have this query that I want to return all records entered from a date range i.e. 10/01/2008 to 01/01/2009. I thought the best way is to use the system date and use the Date() function. The sql is not returning any records as it is. Can someone help?

    SELECT SPACE_habitable.SPACE, SPACE_habitable.FLOOR, SPACE_habitable.BUILDING
    FROM SPACE_habitable
    WHERE (Date() between '10/01/2008' and '01/31/2009')
    ORDER BY Date() DESC;

  2. #2
    Join Date
    Jul 2008
    Location
    Alexandria, Egypt.
    Posts
    38
    Dear Hend,

    You can make a simple query and write in criteria of date field:
    >=[Period from] And <=[To]

    when will you run the query it will ask you period from? (insert the first date 1/1/2008)
    and it will ask you again To? (insert the second date 31/12/2008)

    Please try and feedback

    Thanks

  3. #3
    Join Date
    Jan 2009
    Posts
    3
    Ahmed Elalfy
    The code still does not return any records, Could there be something I'm not referencing? The code looks like this now:

    SELECT SPACE_habitable.SPACE, SPACE_habitable.FLOOR, SPACE_habitable.BUILDING
    FROM SPACE_habitable
    WHERE (((Date())>=[Period From] And (Date())<=[To]))
    ORDER BY Date() DESC;

  4. #4
    Join Date
    Jan 2009
    Posts
    3
    This is NOW returning the full recordset which is not what I want
    The current code looks like this

    SELECT SPACE_habitable.BUILDING, SPACE_habitable.SPACE, SPACE_habitable.FLOOR
    FROM SPACE_habitable
    WHERE (((Date()) Between (Date())>=[Period From] And [To]));

  5. #5
    Join Date
    Jul 2008
    Location
    Alexandria, Egypt.
    Posts
    38
    Hend,
    the function Date() is used to insert the current day date only ... you must add new field in your table to assign date for each record ... and after that you can make query to check records for limited period ...

    Thanks

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

Similar Threads

  1. Replies: 0
    Last Post: 11-12-2008, 05:18 PM
  2. System.mdb or System.mdw?
    By cgriella in forum Access
    Replies: 1
    Last Post: 09-30-2008, 08:16 AM
  3. Return Record # In Query
    By redwinger354 in forum Access
    Replies: 1
    Last Post: 09-15-2007, 01:08 PM
  4. Return records not updated by update query
    By ars80 in forum Queries
    Replies: 2
    Last Post: 05-01-2006, 09:23 AM
  5. Added items in a column.
    By Wrangler in forum Forms
    Replies: 3
    Last Post: 03-25-2006, 07:56 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