I have a report for patient assessment data. This report is filtered based on the AssessmentID and PatientID that the user selects on a form (They select the Assessment date the rest is done behind the scenes). I need to somehow get any hospitalization data that occurred between the date selected and the previous assessment. I am currently able to do this on the form (thanks to help from the query forum), but am having trouble translating this to the report. On the form, I have a list box that gets populated through a query with a parameter. The query is actually a query built on a query. The queries are as follows:
QryAssessmentRange:
SELECT A.PatientID, A.AssessmentDateTime AS LastDT, (Select MAX(B.AssessmentDateTime) FROM tblAssessment B Where B.PatientID = A.PatientID AND
B.AssessmentDateTime < A.AssessmentDateTime) AS PrevDT
FROM tblAssessment AS A;
QryFindCurrentHospitalVisit:
PARAMETERS [AssessDTStart] DateTime;
SELECT H.PatientID, H.HospitalVisitDateTime, H.HospitalVisitID, H.HospitalID, H.HospitalVisitReason, H.HospitalDiagnosis, H.HospitalTreatingPhysician, H.HospitalDischargeDateTime, H.HospitalTreatment, H.HospitalComment, H.EnteredBy, H.EnteredDateTime, TblHospital.HospitalName
FROM TblHospital INNER JOIN (TblHospitalVisit AS H INNER JOIN QryAssessmentRange AS A ON H.PatientID = A.PatientID) ON TblHospital.HospitalID = H.HospitalID
WHERE (((H.HospitalVisitDateTime) Between [A].[PrevDT] And [A].[LastDT]) AND ((A.LastDT)=[AssessDTStart]));
Is it possible to pass the parameter (AssessDTStart) to the subreport? If yes, how do I do that?????????
Hope this makes sense!
Thanks,
Brenda
QryAssessmentRange:
SELECT A.PatientID, A.AssessmentDateTime AS LastDT, (Select MAX(B.AssessmentDateTime) FROM tblAssessment B Where B.PatientID = A.PatientID AND
B.AssessmentDateTime < A.AssessmentDateTime) AS PrevDT
FROM tblAssessment AS A;
QryFindCurrentHospitalVisit:
PARAMETERS [AssessDTStart] DateTime;
SELECT H.PatientID, H.HospitalVisitDateTime, H.HospitalVisitID, H.HospitalID, H.HospitalVisitReason, H.HospitalDiagnosis, H.HospitalTreatingPhysician, H.HospitalDischargeDateTime, H.HospitalTreatment, H.HospitalComment, H.EnteredBy, H.EnteredDateTime, TblHospital.HospitalName
FROM TblHospital INNER JOIN (TblHospitalVisit AS H INNER JOIN QryAssessmentRange AS A ON H.PatientID = A.PatientID) ON TblHospital.HospitalID = H.HospitalID
WHERE (((H.HospitalVisitDateTime) Between [A].[PrevDT] And [A].[LastDT]) AND ((A.LastDT)=[AssessDTStart]));
Is it possible to pass the parameter (AssessDTStart) to the subreport? If yes, how do I do that?????????
Hope this makes sense!
Thanks,
Brenda