Situation: I have a subform that is displayed when
a new patient clinic visit's data is to
be entered.
The primary table contains patient demographic
data. The clinic visits data is in a clinic
visit table. The patient's demographics table
has a one to many relationship with the clinic
visits table. That is for each entry in the
patient's demographics table there can be/are
multiple clinic visits entries in the clinic
visits table for a patient.
Every thing "else" works as it should and/or is
intended to work in this Access App. Er, well
except for some reports. But that help request
is in another posting on this forum.
I would like to be able to populate the new
clinic visits subform data fields with the data
from the patient's most recent (previous)
clinic visit. This would help to speed up data
entry for the clinical staff because some clinic
visit data items do not necessarily change
from clinic visit to the next clinic visit.
So Far: In the fields of the current clinic visit subform
I have a =DLookup function in the data item's
default value in its properties. Of course a query
to go with the DLookUp function.
The Problem: The DLookUp function does find the patient's
previous clinic visit data in the clinic visits
table. However, it finds and displays the
patient's first clinic visit data. Not the
last (most recent) clinic visit's data.
The DLookUp function:
=DLookUp "Lab_INR","Qry_Coumadin_Clinic_Most_Recent_Lab_INR","Tbl_PT_Demographics].[PT_DB_Number]")
The underlying query called by the DLookUp function:
SELECT [Tbl_PT_Demographics].[PT_DB_Number], [Tbl_PT_Demographics].[PT_Name_Last], [Tbl_PT_Demographics].[PT_Name_First], [Tbl_Coumadin_Clinic].[Lab_INR], [Tbl_Coumadin_Clinic].[Lab_Name]
FROM Tbl_PT_Demographics INNER JOIN Tbl_Coumadin_Clinic ON [Tbl_PT_Demographics].[PT_DB_Number]=[Tbl_Coumadin_Clinic].[PT_DB_Number]
WHERE (((Tbl_Coumadin_Clinic.Clinic_Visit_Date)=(SELECT Max(Clinic_Visit_Date)
FROM Tbl_Coumadin_Clinic T WHERE T.PT_DB_Number = Tbl_Coumadin_Clinic.PT_DB_Number));
Solution: OK how do I get this to find the patient's most
recent (last) clinic visit's data?
Is there a better way to populate a subform with
existing data than by using the DLookUp function?
I will greatly appreciate any suggestions, code/method examples, suggestions, etc.
a new patient clinic visit's data is to
be entered.
The primary table contains patient demographic
data. The clinic visits data is in a clinic
visit table. The patient's demographics table
has a one to many relationship with the clinic
visits table. That is for each entry in the
patient's demographics table there can be/are
multiple clinic visits entries in the clinic
visits table for a patient.
Every thing "else" works as it should and/or is
intended to work in this Access App. Er, well
except for some reports. But that help request
is in another posting on this forum.
I would like to be able to populate the new
clinic visits subform data fields with the data
from the patient's most recent (previous)
clinic visit. This would help to speed up data
entry for the clinical staff because some clinic
visit data items do not necessarily change
from clinic visit to the next clinic visit.
So Far: In the fields of the current clinic visit subform
I have a =DLookup function in the data item's
default value in its properties. Of course a query
to go with the DLookUp function.
The Problem: The DLookUp function does find the patient's
previous clinic visit data in the clinic visits
table. However, it finds and displays the
patient's first clinic visit data. Not the
last (most recent) clinic visit's data.
The DLookUp function:
=DLookUp "Lab_INR","Qry_Coumadin_Clinic_Most_Recent_Lab_INR","Tbl_PT_Demographics].[PT_DB_Number]")
The underlying query called by the DLookUp function:
SELECT [Tbl_PT_Demographics].[PT_DB_Number], [Tbl_PT_Demographics].[PT_Name_Last], [Tbl_PT_Demographics].[PT_Name_First], [Tbl_Coumadin_Clinic].[Lab_INR], [Tbl_Coumadin_Clinic].[Lab_Name]
FROM Tbl_PT_Demographics INNER JOIN Tbl_Coumadin_Clinic ON [Tbl_PT_Demographics].[PT_DB_Number]=[Tbl_Coumadin_Clinic].[PT_DB_Number]
WHERE (((Tbl_Coumadin_Clinic.Clinic_Visit_Date)=(SELECT Max(Clinic_Visit_Date)
FROM Tbl_Coumadin_Clinic T WHERE T.PT_DB_Number = Tbl_Coumadin_Clinic.PT_DB_Number));
Solution: OK how do I get this to find the patient's most
recent (last) clinic visit's data?
Is there a better way to populate a subform with
existing data than by using the DLookUp function?
I will greatly appreciate any suggestions, code/method examples, suggestions, etc.