Results 1 to 2 of 2
  1. #1
    mnsemple83 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    40

    Queries that return most recent data for every person.

    I designed a report that includes several subreports containing data relating to a patient. The report is created when the user selects a group of patients from a list, followed by a date value. The report will display all data pertaining to or before that date.



    The subreports obtain their data from the queries, which uses the date value to compile the data. The data I want to focus on for each patient is their four most recent records. If the user selects 3 patients from the list, then enters 8/23/2011 as the date, each subreport will display the four most recent records as of that date.

    The problem here is that the queries will return the four most recent records regardless of the patient. Instead of seeing 4 records for every patient, the reports will only contain a record for a patient if it's in the top 4, meaning not all of the patients will see their data.

    I tried to supply the data from the list of patients selected to the queries but unfortunately, they only can process one value. I need to be able to redesign the queries so they return the 4 most recent entries for each patient and not just in general.

    Any suggestions?

  2. #2
    mnsemple83 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    40
    Do not worry, I solved this problem.

    All I had to do is add a little line of code inside each query that referred to the patient's ID, which is the matching value for each pair of tables involved in the query.

    [Reports]![reportName]![nameofmatchingfield]

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

Similar Threads

  1. Put person's age in a report
    By foxtet in forum Reports
    Replies: 2
    Last Post: 06-18-2011, 07:26 PM
  2. New person here AND with Access
    By Coytee in forum Access
    Replies: 8
    Last Post: 03-08-2010, 01:36 PM
  3. Return most recent entry for each item
    By GenAp in forum Queries
    Replies: 1
    Last Post: 02-04-2010, 05:30 AM
  4. Return all values from two queries
    By matteu1 in forum Queries
    Replies: 0
    Last Post: 08-18-2009, 01:02 PM
  5. Pulling most recent data from child table
    By davidv43 in forum Access
    Replies: 0
    Last Post: 02-07-2009, 11:36 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