Good afternoon all.
I am seeking assistance with a more complex query that maybe needs nested iff statements. I will try and explain the scenario.
This all works / background
My main form contains simple data about a customer. When the user clicks on the communications tab there is a sub form that shows only the communications for that customer. This all works fine. My original issue is that some customers have may communication notes and it can get a bit troublesome scrolling through so I decided to implement a filter. At the moment the sub form is driven by a query that now contains a "reason code" with combo box options for each record / communication log. My parent form contains a combo box with the same options and on the 'after update" function I am running the
function to get the subform to refresh. My query criteria for the 'reason code' field is
This all works fine in limiting the subform results based on the reasoncode. 
Here is the problem
After using this new feature I realise that the end user wants to actually eliminate reasons not applicable to them not just look for see one reason at a time. This means I need to rethink the filter.
What I want
I want to get rid of the filter combo box on the parent form and create checkboxes for the available options. All the checkboxes by default will be true / -1 (or what ever the value is). I then want the query to display all results in the sub form if all checkboxes are true. Upon each checkbox's 'after update' I want the form to requery to update the filter. My issue is I don't know how to built the query criteria for the 'reasonCode' field.
If I use
It may now allow me to just display the 'Presales' reason code. But what about all the others? Will I need to use the '&' at the end of the first iff and have an iff for every option? What if the query criteria contains a null as a consequence of the previous iff? Do I need to use the 'OR' options when building the query criteria? This is my dilemma. I just cant get it to work. :banghead:
Screenshots attached to show my new UI
Many thanks for reading this and thank you in advance if you have any suggestions.
Regards
Dan

I am seeking assistance with a more complex query that maybe needs nested iff statements. I will try and explain the scenario.
This all works / background
My main form contains simple data about a customer. When the user clicks on the communications tab there is a sub form that shows only the communications for that customer. This all works fine. My original issue is that some customers have may communication notes and it can get a bit troublesome scrolling through so I decided to implement a filter. At the moment the sub form is driven by a query that now contains a "reason code" with combo box options for each record / communication log. My parent form contains a combo box with the same options and on the 'after update" function I am running the
Code:
Me.ComNotes.Requery
Code:
[forms]![Frm]![SearchComsFilter]
Here is the problem
After using this new feature I realise that the end user wants to actually eliminate reasons not applicable to them not just look for see one reason at a time. This means I need to rethink the filter.
What I want
I want to get rid of the filter combo box on the parent form and create checkboxes for the available options. All the checkboxes by default will be true / -1 (or what ever the value is). I then want the query to display all results in the sub form if all checkboxes are true. Upon each checkbox's 'after update' I want the form to requery to update the filter. My issue is I don't know how to built the query criteria for the 'reasonCode' field.
If I use
Code:
iff([Forms]![Frm]![PreSalesCheckbox]=-1,"presales",Null)
Screenshots attached to show my new UI
Many thanks for reading this and thank you in advance if you have any suggestions.
Regards
Dan
