I have two combo boxes. The first combo box cmbOTHERName has a list of choices. When you choose something from this combo box, a list of appropriate staff names appears in the second combo box cmbOTHERBy. The staff names that appear are based upon their job title. The problem I have is that one of the choices from the first combo box requires that the names be chosen from several job titles. Listed below is the SQL statement I have used that is successful for the other job titles. The SQL statement is the rowsource for cmbOTHERBY. I would like to add to the SQL statement a choice for cmbOTHERName=Drug/Alcohol and list staff for OT, RT and SW. Is this possible in an IIF statement?
SELECT [LNAME] & ", " & [FNAME] AS staff, [tblStaff].[DISCIPLINE] FROM tblStaff WHERE ((([tblStaff].[DISCIPLINE])=IIf(Trim([cmbOTHERName])="Recreational Therapy","RT",IIf(Trim([cmbOTHERName])="Occupational Therapy","OT",IIf(Trim([cmbOTHERName])="Education","TEACHER","Physical Therapy"))))) ORDER BY 1;
SELECT [LNAME] & ", " & [FNAME] AS staff, [tblStaff].[DISCIPLINE] FROM tblStaff WHERE ((([tblStaff].[DISCIPLINE])=IIf(Trim([cmbOTHERName])="Recreational Therapy","RT",IIf(Trim([cmbOTHERName])="Occupational Therapy","OT",IIf(Trim([cmbOTHERName])="Education","TEACHER","Physical Therapy"))))) ORDER BY 1;