I would like to know what I am doing wrong with a particluar query that I am trying to filter multiple results based on form fields.
I have a table with 4 boolean fields and would like for my query to return the results only where the relevant form check boxes are true. If the criteria for that field is false I don't want it to return if corresponding check box on the form hasn't been ticked. For example if I tick txtBox1 and txtBox 2 on my form I only want to show records where Service 1 OR Service2 are true and so on. Please see code below:
SELECT tblCompany.company_id, tblCompany.company_name, tblCompany.cancelled, tblCompany.Service1, tblCompany. Service2, tblCompany. Service3, tblCompany. Service4
WHERE (((tblCompany.company_id) Not Like 632 And (tblCompany.company_id) Not Like 633) AND ((tblCompany.cancelled)=False) AND ((tblCompany. service1)=[Forms]![frmOtherServices]![txtBox1])) OR (((tblCompany.service2)=[Forms]![frmOtherServices]![txtBox2])) OR (((tblCompany.service3)=[Forms]![frmOtherServices]![txtBox3])) OR (((tblCompany.service4)=[Forms]![frmOtherServices]![txtBox4]))
ORDER BY tblCompany.company_name;
Many thanks for your help in advance