I have made a form in ms-access to get a query output according to the form.
The sql in the access query being:
SELECT w.* FROM work_log1 AS w, [task name] AS t WHERE t.task_name=forms!
[Accenture QC]!combo4 And t.task_id=w.task_name And w.activity_start_date Between
forms ![Accenture QC]!text0 And forms![Accenture QC]!text11
and w.[TAT] = forms![Accenture QC]!combo46
Now everything is working fine, but i want to remove the last filter line if the combo46 is blank.
I have made the sql somehow like this:
and iif(forms![Accenture QC]!combo46 = '', t.task_id=w.task_name ,
t.task_id=w.task_name and w.[TAT] = forms![Accenture QC]!combo46)
Is this the right way to do this, what if there was only this TAT filter to be applied?
I mean if how to write something like this:
"SELECT w.* FROM work_log1 AS w where (w.[TAT] = forms![Accenture QC]!combo46
OR forms![Accenture QC]!combo46 Is Null)"
Thanks
Currently the last part of your
WHEREclause is …If your goal is to ignore that constraint on
w.[TAT]whencombo46is Null, try this:This could be less straightforward if “blank” could mean anything other than Null … eg an empty (zero-length) string or space characters. You could capture all those possibilities in one expression.
In the latest version of your question’s query …