Hi guys,
Hoping someone can help me out with this as it’s an SQL question and I’m still only in the very early days of self learning SQL! 
I have a Form that has 4 combo boxes on it that I have set to requery when the one above is updated so that a user can drill down to some records based on their selections (this is all working fine)
My Combo boxes are:
CmnName
Product
Manufacturer
Supplier
I have created a query that I want to run based on the selections from the Combo boxes.
I want the user to be able to select ANY of the combo boxes individually or multiple selections:
Eg:
If the user selects CmnName & Product it will bring back all the records that match those 2 criteria
OR if the user select Product & Manufacturer it will bring back all the records for those 2
OR if the user Only selects Manufacturer it will bring back all the records for that Manufacturer…..
How do I write the SQL for this to work for the above scenarios??? (I need it so that they can run all off the options individually too)
The SQL I have done doesn’t seem to work?
The query is attached to a command button and It brings back the correct results if I select CmnName & Product and then run it, but comes back blank if I select anything else!?
Here is the SQL from my query:
Code:
SELECT Tbl_Materials_MASTER.ID, Tbl_Materials_MASTER.[Spec No], Tbl_Materials_MASTER.[Common Name], Tbl_Materials_MASTER.[Material Spec], Tbl_Materials_MASTER.[General Material Spec], Tbl_Materials_MASTER.Product, Tbl_Materials_MASTER.Code, Tbl_Materials_MASTER.Supplier, Tbl_Materials_MASTER.Manufacturer, Tbl_Materials_MASTER.Status, Tbl_Materials_MASTER.[Religious/Dietary Status], Tbl_Materials_MASTER.[Country Of Origin], Tbl_Materials_MASTER.MSDS
FROM Tbl_Materials_MASTER
WHERE (((Tbl_Materials_MASTER.[Common Name])=Forms!Frm_SearchMaterialsCombo.CmbCmnName) And ((Tbl_Materials_MASTER.Product)=Forms!Frm_SearchMaterialsCombo.CmbProduct)) Or (((Tbl_Materials_MASTER.Product)=Forms!Frm_SearchMaterialsCombo.CmbProduct) And ((IsNull(Forms!Frm_SearchMaterialsCombo.CmbCmnName))<>False)) Or (((Tbl_Materials_MASTER.[Common Name])=Forms!Frm_SearchMaterialsCombo.CmbCmnName) And ((IsNull(Forms!Frm_SearchMaterialsCombo.CmbProduct))<>False)) Or (((IsNull(Forms!Frm_SearchMaterialsCombo.CmbCmnName))<>False) And ((IsNull(Forms!Frm_SearchMaterialsCombo.CmbProduct))<>False)) Or (((Tbl_Materials_MASTER.Manufacturer)=Forms!Frm_SearchMaterialsCombo.CmbManufac) And ((IsNull(Forms!Frm_SearchMaterialsCombo.CmbManufac))<>False)) Or (((Tbl_Materials_MASTER.Supplier)=Forms!Frm_SearchMaterialsCombo.CmbSupplier) And ((IsNull(Forms!Frm_SearchMaterialsCombo.CmbSupplier))<>False));
(This is not exactly what I wrote it, but this is what it changed it to!)
Hope this all makes sense! 
Any help is muchly appreciated...and apologies if this has been covered before!
Thanks in advance