Hi everybody,
[Access 2003]
I'm working with data to determine if records were completed in a given timeframe. I'm trying to figure out how I can assess records with the same ID, but have different data in other fields to, to come up with compliance for that ID.
Here's the gist...the database tracks info for patients at a hospital. Upon discharge, the charts for the patients get assessed to make sure that each of the forms in the chart are compliant. All patients are entered into the database, but only those that have non-compliant forms are entered in a forms table. The patients that have non-compliant forms may have one form or 20 forms that are non-compliant.
My ultimate goal is to create a crosstab query that will show me the number of charts that are compliant (which would be null in this query because no forms = compliant) and the number of forms that are out of compliance for the program that the patient was housed on.
The part I'm having trouble with is taking the data in the query for one patient that has multiple forms, checking each for compliance, and then returning the number of forms that aren't in compliance. If one form isn't compliant, then the entire chart for that patient is out of compliance. I have a couple of expression used to determine compliance and they display ITF or NITF (in time frame/not in timeframe).
Just for good measure, here's my SQL, but I wouldn't be surprised if some of it needs to be changed. I'm mostly including it so everyone can see the fields and expressions used thus far:
Thanks for the help...
[Access 2003]
I'm working with data to determine if records were completed in a given timeframe. I'm trying to figure out how I can assess records with the same ID, but have different data in other fields to, to come up with compliance for that ID.
Here's the gist...the database tracks info for patients at a hospital. Upon discharge, the charts for the patients get assessed to make sure that each of the forms in the chart are compliant. All patients are entered into the database, but only those that have non-compliant forms are entered in a forms table. The patients that have non-compliant forms may have one form or 20 forms that are non-compliant.
My ultimate goal is to create a crosstab query that will show me the number of charts that are compliant (which would be null in this query because no forms = compliant) and the number of forms that are out of compliance for the program that the patient was housed on.
The part I'm having trouble with is taking the data in the query for one patient that has multiple forms, checking each for compliance, and then returning the number of forms that aren't in compliance. If one form isn't compliant, then the entire chart for that patient is out of compliance. I have a couple of expression used to determine compliance and they display ITF or NITF (in time frame/not in timeframe).
Just for good measure, here's my SQL, but I wouldn't be surprised if some of it needs to be changed. I'm mostly including it so everyone can see the fields and expressions used thus far:
Code:
SELECT DISTINCT qryPatientDetail.PatientDetailID, qryPatientDetail.Episode, qryPatientDetail.DischargeDate, NZ([FormName]) AS Form, qryForms.FormName, qryPrograms.ProgramInitials, IIf(([ComplianceCalculationConsideration]=True) Or (IsNull([FormName])),True,False) AS CCC, qryEpisodeDetail.CorrectedDate, IIf(([correcteddate]>([dischargedate]+30)) Or (IsNull([correcteddate]) And (Date()>[dischargedate]+30)),"Not ITF","ITF") AS ITF FROM (qryForms RIGHT JOIN ((qryPatientDetail LEFT JOIN qryEpisodeDetail ON qryPatientDetail.PatientDetailID = qryEpisodeDetail.PatientDetailIDFK) LEFT JOIN qryDeficiencyType ON qryEpisodeDetail.DeficiencyIDFK = qryDeficiencyType.DeficiencyTypeID) ON qryForms.FormID = qryEpisodeDetail.FormIDFK) LEFT JOIN qryPrograms ON qryPatientDetail.ProgramIDFK = qryPrograms.ProgramID WHERE (((qryPatientDetail.DischargeDate) Between #3/1/2009# And #3/31/2009#)) ORDER BY qryPatientDetail.PatientDetailID, qryPatientDetail.DischargeDate;
Comment