I am trying to use option boxes on a search form to select how the user will search. There are 3 option boxes and depending on which one the user selects I want it to run a certain criteria. I would like to do it in one query instead of using multiple queries. I am using IFF statements in the criteria field. Here is my SQL code:
Code:
SELECT Devices.[Device ID], Devices.Description, Devices.Location, Devices.Upstream
FROM Devices
WHERE (((Devices.[Device ID])=IIf([Forms]![SearchForm]![OptionFMB]=True,([Devices].[Device ID]) Like [Forms]![SearchForm]![SearchBox] & "*",Null))) OR
(((Devices.Description)=IIf([Forms]![SearchForm]![OptionDescription]=True,([Devices].[Description]) Like [Forms]![SearchForm]![SearchBox] & "*",Null))) OR
(((Devices.Location)=IIf([Forms]![SearchForm]![OptionLocation]=True,([Devices].[Location]) Like [Forms]![SearchForm]![SearchBox] & "*",Null)))
ORDER BY Devices.[Device ID];
I try to run the search and it is just pulling up Null. Any ideas where I am going wrong?