Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Date query from datasheet in subform

0 views
Skip to first unread message

Gamefewel

unread,
Jan 5, 2010, 9:31:02 PM1/5/10
to
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

KARL DEWEY

unread,
Jan 6, 2010, 6:02:01 PM1/6/10
to
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;

--
Build a little, test a little.

0 new messages