Date query from datasheet in subform

G

Gamefewel

I have a database of diabetic patients. I have a form that has all the
patient info, like name, address, etc. I think have a subform that is a
datasheet view that has all the lab results of this patient. I would like to
run a query to see what patients do not have lab results in the last 6
months. I can't do a Between date, as it will pull the dates between those
dates, but could still have a lab in the last 6 months. What I need, and
don't know if i can be done, is a query that only queries the last record in
the subfrom. Possible? Thanks
 
K

KARL DEWEY

Try this --
SELECT Patient_Table.*
FROM Patient_Table LEFT JOIN LabTest ON Patient_Table.PatientID =
LabTest.PatientID
WHERE Patient_Table.PatientID <> (SELECT [XX].PatientID FROM LabTest AS [XX]
WHERE [XX].Lab_Date >= DateAdd("m", -6, Date()) AND Patient_Table.PatientID =
[XX].PatientID)
ORDER BY Patient_Table.PatientID;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top