Hello -
I am trying to limit the options that show in a combo box based on the value of another field.
In the design view of my query, I have the following criteria in the ReferralRole_ID field:
This translates to the following SQL:
I am getting zero records in my combo.
If I just put < 1 OR 2 OR 7 > in the criteria, it works fine.
Not sure if the IIF statement is coded correctly.
Many thanks
Sandra
I am trying to limit the options that show in a combo box based on the value of another field.
In the design view of my query, I have the following criteria in the ReferralRole_ID field:
Code:
=IIf([Form]![f_MainReferralForm]![ActivityType_ID]=9,(1 Or 2 Or 7),(3 Or 7))
Code:
SELECT t_ReferralRoles_LU.ReferralRole_ID, t_ReferralRoles_LU.ReferralRole FROM t_ReferralRoles_LU WHERE (((t_ReferralRoles_LU.ReferralRole_ID)=IIf([Form]![f_MainReferralForm]![ActivityType_ID]=9,((t_ReferralRoles_LU.ReferralRole_ID)=1 Or (t_ReferralRoles_LU.ReferralRole_ID)=2 Or (t_ReferralRoles_LU.ReferralRole_ID)=7),((t_ReferralRoles_LU.ReferralRole_ID)=3 Or (t_ReferralRoles_LU.ReferralRole_ID)=7)))) ORDER BY t_ReferralRoles_LU.ReferralRole_ID;
If I just put < 1 OR 2 OR 7 > in the criteria, it works fine.
Not sure if the IIF statement is coded correctly.
Many thanks
Sandra
Comment