Results 1 to 3 of 3
  1. #1
    corkbric is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    May 2015
    Posts
    2

    Latest record from table with repeatable entries and non repeatable entries


    Hi,

    Have a database with multiple tables, one of the tables has several fields, but only 3 are of concern at the moment, ID, AgreementID and MaintenanceDate. ID is non repeating and link to other tables, AgreementID is repeatable and the MDate field just holds the date that maint was performed. Table keeps track of maint on customer equip, so ID 1 could have 50 entries, so forth and so on. Trying to find a way to pull the dates of the most recent maintenance times so those dates can be bounced with the current date to give a total number of days since last maint was performed. I just cannot figure it out. This is the last piece of the database to finish up. It's going to be a query that feeds a report. Any help would be greatly appreciated. Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Can use an aggregate (GROUP BY) Totals query to return the latest date for each agreement.

    SELECT AgreementID, Max(MaintenanceDate) AS LatestDate FROM tablename GROUP BY AgreementID;

    If you want the entire record, here is one method http://allenbrowne.com/subquery-01.html#TopN
    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
    corkbric is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    May 2015
    Posts
    2
    Worked like a charm, tyvvm.

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

Similar Threads

  1. Combine record entries
    By cactuspete13 in forum Queries
    Replies: 2
    Last Post: 05-06-2014, 08:32 AM
  2. Replies: 11
    Last Post: 03-13-2014, 09:54 AM
  3. Single record for multiple entries
    By MelHerndon in forum Database Design
    Replies: 3
    Last Post: 08-06-2012, 10:48 AM
  4. Queries, using record entries only once?
    By no1beyondfan in forum Queries
    Replies: 11
    Last Post: 04-20-2011, 08:57 AM
  5. Replies: 1
    Last Post: 09-21-2010, 09:49 AM

Tags for this Thread

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