dim sqlstr as string
sqlstr = "select * from table where 1=1 "
if textbox1.text <> "" then sqlstr += " and col1=" & textbox1.text
end if
if textbox2.text <> "" then sqlstr += " and col2=" & textbox2.text
end if
if textbox3.text <> "" then sqlstr += " and col3=" & textbox3.text
end if
.....