I have a form with 3 text boxes and a listbox. I want to be able to type into the text boxes what I want to search for. If 2 of the boxes are filled out I want to search both strings. For example, the textboxes are named txtmodel, txtmake, and txtcolor. If I type a value in txtmodel and txtmake I want to be able to search the table for those values. I just need help on the sql statement. I know I need if isnull statements for each txtbox.
I am setting the listbox to the sql string. I have the following code but it is not working. What am I doing wrong?
"SELECT Inv_ID, StockNbr, UnitStatus, Year, Make, Model, Color, UnitStatus FROM tblInventory WHERE model LIKE '*" & Me.txtModel & "'* OR make LIKE '*" & Me.txtMake & "'* OR color LIKE '*" & Me.txtColor & "'*"