cCL_Ref = thisForm.lcCl_Ref cIA_Ref = IIF(thisForm.cAssessment="I", thisForm.lcIa_Ref, "") cCO_Ref = IIF(thisForm.cAssessment="C", thisForm.lcCo_Ref, "") cCI_Ref = IIF(thisForm.cAssessment="P", thisForm.lcCi_Ref, "") Select ... WHERE Ccmslook.lk_type = "AB" AND Careplan.cl_ref = ?cCL_Ref AND Careplan.ia_ref = ?cIA_Ref AND Careplan.co_ref = ?cCO_Ref AND Careplan.ci_ref = ?cCI_Ref ORDER BY Careplan.cp_type