G
gtslabs
I have a Query in my Record Source of a Form.
It references 2 combo boxes. I want to display records based on both
boxes or if Box1 is Null then only Box2
I used the following as substitutions as I am getting confused with
the many ().
A = ((Log.Project)=[Forms]![frmMainForm]![cbo1])
B = ((Log.Pour_Date)=[Forms]![frmMainForm]![cbo2])
C = ((([Forms]![frmMainForm]![cbo1]) Is Null));
SELECT *
FROM Log
WHERE iif(IsNull(A,B,(A AND B))) OR C
I have the following SQL statement:
SELECT *
FROM Log
WHERE iif(IsNull(((Log.Project)=[Forms]![frmMainForm]![cbo1]),
((Log.Pour_Date)=[Forms]![frmMainForm]![cbo2]),
(((Log.Project)=[Forms]![frmMainForm]![cbo1])
AND ((Log.Pour_Date)=[Forms]![frmMainForm]![cbo2])))) OR ((([Forms]!
[frmMainForm]![cbo1]) Is Null));
I beleive I have my () in order but I still can not make it work.
Can I used the IIF in a SQL? What is wrong?
It references 2 combo boxes. I want to display records based on both
boxes or if Box1 is Null then only Box2
I used the following as substitutions as I am getting confused with
the many ().
A = ((Log.Project)=[Forms]![frmMainForm]![cbo1])
B = ((Log.Pour_Date)=[Forms]![frmMainForm]![cbo2])
C = ((([Forms]![frmMainForm]![cbo1]) Is Null));
SELECT *
FROM Log
WHERE iif(IsNull(A,B,(A AND B))) OR C
I have the following SQL statement:
SELECT *
FROM Log
WHERE iif(IsNull(((Log.Project)=[Forms]![frmMainForm]![cbo1]),
((Log.Pour_Date)=[Forms]![frmMainForm]![cbo2]),
(((Log.Project)=[Forms]![frmMainForm]![cbo1])
AND ((Log.Pour_Date)=[Forms]![frmMainForm]![cbo2])))) OR ((([Forms]!
[frmMainForm]![cbo1]) Is Null));
I beleive I have my () in order but I still can not make it work.
Can I used the IIF in a SQL? What is wrong?