Dim strSQL As String = "SELECT * FROM table WHERE 1=1"
IF Trim(txt1.Text) <> "" Then
strSQL = strSQL & " AND Column1 LIKE '%" & Trim(txt1.Text) & "%' "
End IF
IF Trim(txt2.Text) <> "" Then
strSQL = strSQL & " AND Column2 LIKE '%" & Trim(txt2.Text) & "%' "
End IF
IF Trim(txt3.Text) <> "" Then
strSQL = strSQL & " AND Column3 LIKE '%" & Trim(txt3.Text) & "%' "
End IF