Hi Willem,
Can Textbox1 and Textbox2 contain a value at the same time , or only one of them at the same time?
If textbox1.text<>"" and textbox2<>"" then
strQuery = "SELECT * FROM Table WHERE
Field LIKE %" & Textbox1.text & "% OR Field
LIKE %" & Textbox2.text & "%"
elseif Textbox1.text<>"" end Textbox2.text="" then
strQuery = "SELECT * FROM Table WHERE
Field LIKE %" & Textbox1.text & "%
elseif Textbox1.text="" end Textbox2.text<>"" then
strQuery = "SELECT * FROM Table WHERE
Field LIKE %" & Textbox2.text & "%
endif
This will do the job.
If you don't need all fields from the table, replace the * for the fieldnames separated bij a ,
This will speedup yor query when using larger databases.
Grtz,
Nokkieja