Situation: I have an Access App running that works
correctly (mostly).
In this app I have a report that
displays/prints the current/most recent clinic
visit data for the currently selected patient.
At least it is suppose to.
The report will print the data for every
patient's most recent clinic visit unless I
force it, by adding some "code" in to the query
to force it to prompt for an index number (to
prompt for a patient number (patient demographic
table index number).
There are two tables. A patient demographics
data table and a patient clinic visits data
table. The patient demographics table has a
one to many relationship with the patient
clinic visits data table. For each patient
there can be/are multiple clinic visits data
entries.
The query:
SELECT DISTINCTROW [Tbl_Coumadin_Clinic].[PT_DB_Number], [Tbl_PT_Demographics].[PT_Name_Last], [Tbl_PT_Demographics].[PT_Name_Prefix], [Tbl_PT_Demographics].[PT_Name_First], [Tbl_PT_Demographics].[PT_Name_Middle], [Tbl_PT_Demographics].[PT_Name_Suffix], [Tbl_Coumadin_Clinic].[Clinic_Visit_Date], [Tbl_Coumadin_Clinic].[Medication], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Mon], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Tue], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Wed], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Thu], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Fri], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Sat], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Sun], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Mon], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Tue], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Wed], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Thu], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Fri], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Sat], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Sun], [Tbl_Coumadin_Clinic].[Next_Lab_Date], [Tbl_Coumadin_Clinic].[Next_Visit_Med_Date]
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) ) );
When the report is selected to be run there is a
currently selected patient. So the Index in to
the patient demographic data table is set to a
value. Is the problem I must somehow "pass"
this number to the query or at least somehow
make it available to it?
I will greatly appreciate any help. coding/methods examples, suggestions, etc.
correctly (mostly).
In this app I have a report that
displays/prints the current/most recent clinic
visit data for the currently selected patient.
At least it is suppose to.
The report will print the data for every
patient's most recent clinic visit unless I
force it, by adding some "code" in to the query
to force it to prompt for an index number (to
prompt for a patient number (patient demographic
table index number).
There are two tables. A patient demographics
data table and a patient clinic visits data
table. The patient demographics table has a
one to many relationship with the patient
clinic visits data table. For each patient
there can be/are multiple clinic visits data
entries.
The query:
SELECT DISTINCTROW [Tbl_Coumadin_Clinic].[PT_DB_Number], [Tbl_PT_Demographics].[PT_Name_Last], [Tbl_PT_Demographics].[PT_Name_Prefix], [Tbl_PT_Demographics].[PT_Name_First], [Tbl_PT_Demographics].[PT_Name_Middle], [Tbl_PT_Demographics].[PT_Name_Suffix], [Tbl_Coumadin_Clinic].[Clinic_Visit_Date], [Tbl_Coumadin_Clinic].[Medication], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Mon], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Tue], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Wed], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Thu], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Fri], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Sat], [Tbl_Coumadin_Clinic].[Med_Dose_Wk1_Sun], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Mon], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Tue], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Wed], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Thu], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Fri], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Sat], [Tbl_Coumadin_Clinic].[Med_Dose_Wk2_Sun], [Tbl_Coumadin_Clinic].[Next_Lab_Date], [Tbl_Coumadin_Clinic].[Next_Visit_Med_Date]
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) ) );
When the report is selected to be run there is a
currently selected patient. So the Index in to
the patient demographic data table is set to a
value. Is the problem I must somehow "pass"
this number to the query or at least somehow
make it available to it?
I will greatly appreciate any help. coding/methods examples, suggestions, etc.