已经找到。多条件之间用空格分割。分二种情况,“与”和“或”。
1、“与”
Private Sub Text0_Change()
If IsNull(Me.Text0) Then Exit Sub
Dim i, IntStar As Integer
Dim strCx As String
If KeyCode = vbKeySpace Then Exit Sub '分隔符不为空格时,可省去
IntStar = Text0.SelStart
For i = 0 To UBound(Split(Text0.Text, " "))
strCx = strCx & "InStr(字段名, '" & Split(Text0.Text, " ")(i) & "') > 0 And "
Next i
Me.Child0.Form.Filter = strCx & True
Me.Child0.Form.FilterOn = True
IntStar = IntStar + 1
Text0.SelStart = IntStar
End Sub
2、“或”,就是你所要的情况
Private Sub Text0_Change()
If IsNull(Me.Text0) Then Exit Sub
Dim i, IntStar As Integer
Dim strCx As String
If KeyCode = vbKeySpace Then Exit Sub '分隔符不为空格时,可省去
IntStar = Text0.SelStart
For i = 0 To UBound(Split(Text0.Text, " "))
strCx = strCx & "InStr(字段名, '" & Split(Text0.Text, " ")(i) & "') > 0 Or "
Next i
Me.Child0.Form.Filter = strCx & False
Me.Child0.Form.FilterOn = True
IntStar = IntStar + 1
Text0.SelStart = IntStar
End Sub
如果需要实例,请做个模拟库上传。
[此贴子已经被作者于2006-7-20 19:27:17编辑过]
|