I am trying to make a multi-field search where if a user enters data into a search prompt it will return all similar entries to it and if they leave the fields in the prompt blank it will return all entries for that field including blank entries in the records. The data is stored in a table called BookTable and I have a second table called Priorsearch which stores the text the user inputted in their search. I've tried this code for the criteria:
IIf(IsNull(DLookUp("Customer","PriorSearch")),Like "*" Or Is Null,Like "*" & DLookUp("Customer","PriorSearch") & "*")
On their own each part of the codes works fine however together they won't work saying that it is giving the wrong datatype. Removing the "is null" stops that error however then it doesn't give any results at all regardless if you enter data into the field or not. The program also keeps trying to throw ([BookTable].[Customer]) in front of the "Likes". Anyone have any suggestions on how to get this to work?