Dim Filter As String
With e.Form.Controls("省份")
If .Value IsNot Nothing Then
Filter = "省份 in ('" & .value.replace(",","','") & "')"
End If
End With
With e.Form.Controls("区域")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter &= "区域 in ('" & .value.replace(",","','") & "')"
End If
End With
With e.Form.Controls("产品类")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter &= "产品类 in ('" & .value.replace(",","','") & "')"
End If
End With
With e.Form.Controls("TextBox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Dim str As String = "1=1"
For Each s As String In .value.split("*")
If s > "" Then
str &= " and 品牌产品规格 like '%" & s & "%'"
End If
Next
Filter = filter & "(" & str & ")"
End If
End With
msgbox(filter)
Tables("表A").Filter = Filter
[此贴子已经被作者于2018/1/18 17:20:39编辑过]