Results 1 to 4 of 4
  1. #1
    Joy Pxley is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    2

    Query for most recent date-and-time when records have multiple times for 1 date

    Hi,

    Totally new to Access and struggling with an insane deadline, so I appreciate any help I can get.

    I have a table with records of client interactions. Most clients have multiple records. Each record has a date field and a time field. I need to create a set of queries to find the most recent date-and-time, and then link it to the outcome listed in that record.

    I was able to follow directions on the site linked below to construct one query that found the most recent date for each client (that part worked), and a second query that linked that most recent date to the rest of the record and showed the outcome (that part did not work).


    http://office.microsoft.com/en-us/ac...010341693.aspx

    That's when I realized that I have have multiple records (different times) for the same client on the same day, sometimes on the last day. So the second query returned multiple records for some clients and multiple outcomes not the "final outcome" (last time) that I need.

    I've been searching around and can't figure out how to make a new query or combination of queries that finds the last time within the last date within a client.

    Any guidance is welcome!

    Thanks!
    Joy

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It was probably a mistake to store them separately, but I assume it's too late to change. You can create a query that grabs all the fields from the table plus create a combined field. In design view it would look like:

    CombinedDateTime: DateFieldName + TimeFieldName

    Then use that as your base rather than the table, and use the combined field. You may find this simpler:

    http://www.baldyweb.com/LastValue.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Joy Pxley is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    2
    Thanks Paul! I'm not used to the "select" "from" etc. way of talking about queries, but I think I can figure it out. One question though: what does it mean that in the second query there's a "*" after VehicleMiles.?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    That symbol is a shortcut that means "all" in that context. In other words, instead of listing the fields individually, that will select all fields.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 02-27-2014, 08:25 PM
  2. Most recent Date query
    By SmartestIdiot in forum Queries
    Replies: 1
    Last Post: 01-11-2014, 07:56 AM
  3. Query Help Returning Most Recent Date's Value
    By cperry88 in forum Queries
    Replies: 1
    Last Post: 01-08-2014, 03:03 PM
  4. Replies: 4
    Last Post: 05-26-2013, 08:53 PM
  5. Replies: 4
    Last Post: 05-04-2010, 03:33 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