Results 1 to 8 of 8
  1. #1
    Join Date
    May 2020
    Posts
    26

    Find records based on a variable date

    I have a simple table with a date field.



    I want to be able to extract the records that are newer than a date that I will input.
    This date would be different each time but the range would always be the same , eg 6 days

    The record set changes so it is not a fixed point in time.

    To summarise, need a query that asks for a date to be input, and then returns any records with a date greater than the input date minus 6 days.

    Thanks

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Review the links in the Similar Threads at the bottom of the page. You'll also find some related posts if you search the forum.

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    In the criteria row for the date field enter something like this:

    >[Enter Date]-6

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    1. extract the records that are newer than a date that I will input.

    2. returns any records with a date greater than the input date minus 6 days.


    so input date is 10/10/2020 (10th October)

    1 requires return of records between 10th and 16th
    2 requires return of records between 4th and 10th

    which is it? Always better to use example

  5. #5
    Join Date
    May 2020
    Posts
    26
    yeah I tried that but I get an error message implying the information typed in is not correct. Tried adding # marks for dates inside and outside the brackets

  6. #6
    Join Date
    May 2020
    Posts
    26
    So input he 16th Oct and it would return everything newer than the 10th

  7. #7
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Please try >CDate([Enter Date])-6.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    the description of your requirement is still vague

    it would return everything newer than the 10th
    so you are now saying (if) today is 28th October - you enter 16th October so you want everything from 10th October to 28th October?

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

Similar Threads

  1. Find Avg based on Date Range
    By mpaulbattle in forum Queries
    Replies: 6
    Last Post: 11-22-2016, 03:06 PM
  2. Replies: 3
    Last Post: 08-24-2015, 03:30 PM
  3. Replies: 1
    Last Post: 12-22-2012, 12:38 PM
  4. Query to find all records after a certain date
    By Matt Parsons in forum Queries
    Replies: 2
    Last Post: 08-24-2011, 06:22 AM
  5. Find records based on a field in a form
    By rbw95662 in forum Programming
    Replies: 3
    Last Post: 06-15-2010, 04:12 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