问题如下:表里有A B C D E 五列,五列中有相同值出现的情况。
我搞了个按钮,功能为查找任意列有1这个值出现的结果。现在想要增加功能,变为查询任意列有1,并且有2出现的结果。
放两个combox 放num1 和num2的值,然后查找。
请问我的代码要怎么改?
Dim Filter As String
With e.Form.Controls("num1")
If .Value IsNot Nothing Then
Filter = "A = '" & .Value & "'"
End If
End With
With e.Form.Controls("num1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " Or "
End If
Filter = Filter & "B = '" & .Value & "'"
End If
End With
With e.Form.Controls("num1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " Or "
End If
Filter = Filter & "C = '" & .Value & "'"
End If
End With
With e.Form.Controls("num1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " Or "
End If
Filter = Filter & "D = '" & .Value & "'"
End If
End With
With e.Form.Controls("num1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " Or "
End If
Filter = Filter & "E = '" & .Value & "'"
End If
End With
If Filter > "" Then
Tables("information").Filter = Filter
End If
[此贴子已经被作者于2018/12/7 14:50:41编辑过]