Results 1 to 6 of 6
  1. #1
    LassoCraig is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    3

    Latest Date Criteria

    Hello I'm new to the forum and Access.

    I extract Data from a Data feed that is not dated.



    Through an Append Query I add an appropriate date and build a "dated' Database.

    I am having trouble extracting the most recent set of records from that Database using various Criteria.

    Would appreciate suggested criteria.\ to use

    The answer might be really obvious, but not currently for me.

    Thanks in Advance

    Lasso

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    LassoCraig is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    3
    Thanks June for the quick response.

    Looks like I need to advance my Access skills to follow the attachment. I mistakenly though that querying for the Latest Date would be pimplier than that

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Query for the lastest (maximum) data is simple. Returning the record that goes with that date is more complicated.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Cottonshirt is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Feb 2018
    Posts
    116
    depending on what exactly you are trying to achieve, there are a number of ways of going about this.

    1. if you want records associated with the latest date:
    a. run an AGGREGATE query to ask for the maximum date: Max(datefield)
    b. once you know the maximum date, run a second query extracting records with that date.

    2. if you want all records dated in the last n days
    a. the criteria, in the date field, will be: [datefield]>=Date()-n


    good luck with your project,



    Cottonshirt

  6. #6
    LassoCraig is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    3
    Thank you Cottonshirt for the prompt response.

    option 2 worked a treat

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

Similar Threads

  1. Choosing latest criteria amongst choices
    By sergi117 in forum Queries
    Replies: 5
    Last Post: 10-08-2018, 08:27 PM
  2. Replies: 3
    Last Post: 01-06-2016, 07:42 PM
  3. latest date
    By slimjen in forum Programming
    Replies: 11
    Last Post: 09-12-2014, 08:46 PM
  4. Value of latest date
    By v!ctor in forum Queries
    Replies: 3
    Last Post: 02-27-2013, 03:48 PM
  5. How do you get the latest date?
    By radicrains in forum Queries
    Replies: 6
    Last Post: 10-27-2010, 08:59 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