Results 1 to 2 of 2
  1. #1
    kfinpgh is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2006
    Posts
    7

    Select last 2 dates of service

    I work in a medical environment and my current project requires the last 2 visits for selected patients. Is there a way to do this using one query? At this point, I have to create one query to get the patient's latest visit then feed that to another query to get any previous visits.

    I can also make a VBA module if someone has thoughts in that direction.

    Several notes:

    Not all patients will have 2 visits. Some may have one and others may have 3 or more.
    The project has an end date, but there is no begin date for the visits.
    We sometimes have a 30, 60 or 90 day gap required between visits. That varies with the project.
    Multiple visits on the same date are not counted.

    I usually start off with a long list of patients and need to keep the entire list and show any missed visits with a blank or null value. I keep counters in the queries to show and calculate a percentage.



    There are more items to toss into the mix after I do this part of the task.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would this sorting DESC and asking for the TOP 2 would do it.

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

Similar Threads

  1. Database and Software as a Service
    By Hcasty in forum Programming
    Replies: 1
    Last Post: 09-11-2009, 03:03 AM
  2. SQL service connection
    By selma_ in forum Import/Export Data
    Replies: 5
    Last Post: 08-20-2009, 04:01 AM
  3. Due dates
    By Mehbastan in forum Queries
    Replies: 5
    Last Post: 08-14-2009, 08:37 AM
  4. Exracting Dates
    By Elizabeth in forum Access
    Replies: 2
    Last Post: 04-02-2009, 11:26 AM
  5. Help with Searching Dates
    By rededdie in forum Access
    Replies: 1
    Last Post: 11-02-2007, 08:34 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