把上面的代码改了一下,测试有效。
Dim txts() As String
Dim str As String
Dim temp As String
Dim txt As String = e.Form.Controls("TextBox1").Text
Dim tbl As Table = Tables("窗口1_Table1")
If txt = "" Then
tbl.Filter = ""
Else
txt = txt.TrimEnd()
txts= txt.Split(" ")
For Each str In txts
If temp > "" Then
temp = temp & " and "
End If
temp = temp & "公司名称 Like '*" & str & "*'"
Next
tbl.Filter = temp
End If