Results 1 to 2 of 2
  1. #1
    ande8698! is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    4

    Struggling to use DMax for dates

    I am performing a query involving two tables. The first table has fields including: last name, first name, and Site ID. The second table has last name, first name, site id, and date reported. The second table also has multiple records for the person and site id, with different dates for the "date reported" field. When I run my query, I am specifying criteria for last name, first name, and site id, but I would like to use DMax to show only the most recent date reported. Any help in this task 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
    53,771
    You want max date for each name/site ID pair?

    SELECT LastName, FirstName, SiteID, Max(DateReported) AS MaxDate FROM Tablename GROUP BY LastName, FirstName, SiteID;

    Or build a report using Sorting & Grouping features with aggregate calcs in footer sections.

    Why are you saving duplicate data? Instead of saving name and SiteID in second table, just save the primary key of table 1 records.
    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.

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

Similar Threads

  1. Struggling with this query
    By ramangill in forum Queries
    Replies: 8
    Last Post: 04-10-2014, 09:14 PM
  2. Replies: 6
    Last Post: 07-24-2012, 03:02 PM
  3. New to access and struggling
    By Erica Nichols in forum Reports
    Replies: 3
    Last Post: 03-28-2012, 03:02 PM
  4. My first Database, struggling a bit
    By ravihotwok in forum Access
    Replies: 1
    Last Post: 12-07-2011, 05:17 AM
  5. struggling with query, plz help
    By jimgros in forum Queries
    Replies: 2
    Last Post: 07-26-2011, 03:35 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