Dim Filter As String = "1=1"
Dim flt As String = ""
With e.Form.Controls("textbox9")
If .Value IsNot Nothing Then
Dim str As String = ""
For Each s As String In .value.split(" ")
str &= " or yxmc like '%" & s & "%'"
Next
flt &= str
End If
End With
With e.Form.Controls("textbox12")
If .Value IsNot Nothing Then
Dim str As String = ""
For Each s As String In .value.split(" ")
str &= " or yxmc like '%" & s & "%'"
Next
flt &= str
End If
End With
With e.Form.Controls("textbox13")
If .Value IsNot Nothing Then
Dim str As String = ""
For Each s As String In .value.split(" ")
str &= " or yxmc like '%" & s & "%'"
Next
flt &= str
End If
End With
With e.Form.Controls("textbox14")
If .Value IsNot Nothing Then
Dim str As String = ""
For Each s As String In .value.split(" ")
str &= " or yxmc like '%" & s & "%'"
Next
flt &= str
End If
End With
With e.Form.Controls("textbox15")
If .Value IsNot Nothing Then
Dim str As String = ""
For Each s As String In .value.split(" ")
str &= " or yxmc like '%" & s & "%'"
Next
flt &= str
End If
End With
With e.Form.Controls("textbox16")
If .Value IsNot Nothing Then
Dim str As String = ""
For Each s As String In .value.split(" ")
str &= " or yxmc like '%" & s & "%'"
Next
flt &= str
End If
End With
If flt > "" Then
Filter &= " and (" & flt.substring(3) & ")"
End If
msgbox(filter)
Tables("高考信息查询表").Filter = Filter
老师我按的写的代码是这样的