Use a correlated subquery. The query would look something like the following
Replace PatientVisits with the name of your table and the field names with the
relevant names of your fields.
SELECT PatientVisits.*
FROM [PatientVisits]
WHERE VisitDate in
(SELECT Top 2 VisitDates
FROM [PatientVisits] as TEMP
WHERE Temp.PatientID = [PatientVisits].PatientID
ORDER BY VisitDates DESC)
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County