Results 1 to 8 of 8
  1. #1
    ratercero is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2017
    Posts
    16

    Filter latest date of a value

    Hello, I have a query from 2 tables, with a unique id linking them together. this id gets duplicated in the query, how can I retrieve each ID with the latest date with the latest date?



    Thank you

    RT
    Last edited by ratercero; 05-31-2017 at 12:37 PM.

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    How can a unique Id be duplicated? Why is any field being duplicated? Or are rows being duplicated. More info please.

  3. #3
    ratercero is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2017
    Posts
    16
    Hello Andy,

    I have a query, that links 2 tables together from a Form and Subform as shown in the following picture:

    Click image for larger version. 

Name:	Query design.JPG 
Views:	6 
Size:	71.1 KB 
ID:	28934

    I need to show only one line per MR_ID wich has the latest date, this is the table im getting and I neet to remove the higlighted line using the criteria of max date per MR_ID:
    Click image for larger version. 

Name:	Query table.JPG 
Views:	6 
Size:	46.4 KB 
ID:	28935


    Hope I explanied myself better this time.

    Thanks

  4. #4
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Under your data field (Fecha_de_Cambio), change the "Group By" entry on the Totals row to "Max", and it will return the latest date for each of those groupings.

  5. #5
    ratercero is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2017
    Posts
    16
    JoeM,

    The fields "Cambio", "Razon", Actualizado_por" also Change so when I follow your advise I get the same outcome:

    Click image for larger version. 

Name:	Max.JPG 
Views:	6 
Size:	70.0 KB 
ID:	28936Click image for larger version. 

Name:	Table2.JPG 
Views:	6 
Size:	47.6 KB 
ID:	28937

  6. #6
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Remove all fields other than your ID and the date field from your query.
    If you want to get the details (other associated fields), then create a new query, joining this two field query back to your original table on BOTH fields, and return all the fields that you want.

  7. #7
    ratercero is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2017
    Posts
    16
    Worked like a charm, Thanks JoeM!

  8. #8
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You are welcome!

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

Similar Threads

  1. latest date
    By slimjen in forum Programming
    Replies: 11
    Last Post: 09-12-2014, 08:46 PM
  2. Value of latest date
    By v!ctor in forum Queries
    Replies: 3
    Last Post: 02-27-2013, 03:48 PM
  3. ComboBox always contain latest Monday date
    By tylerg11 in forum Forms
    Replies: 3
    Last Post: 08-30-2012, 01:33 PM
  4. How do you get the latest date?
    By radicrains in forum Queries
    Replies: 6
    Last Post: 10-27-2010, 08:59 PM
  5. Latest Date Records
    By Rick West in forum Queries
    Replies: 1
    Last Post: 09-25-2009, 11:16 AM

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