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.