Dim Filter As String = "1=1"
With e.Form.Controls("combobox1")
If .Value IsNot Nothing Then
Filter = Filter & " and kl = '" & .Value & "'"
End If
End With
With e.Form.Controls("combobox2")
If .Value IsNot Nothing Then
Filter = Filter & " and lqpc like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("CheckedComboBox1")
If .Value <> Nothing Then
Filter &= " and 年度 in ('" & .Value.replace(",", "','") & "')"
End If
End With
With e.Form.Controls("textbox6")
If .Value IsNot Nothing Then
Dim str As String = ""
For Each s As String In .value.split(" ")
str &= "名称 like '%" & s & "%' or "
Next
Filter &= " and (" & str.substring(0, str.length-4) & ")"
End If
End With
With e.Form.Controls("CheckedComboBox2")
If .Value <> Nothing Then
Filter &= " and 省份名称 in ('" & .Value.replace(",", "','") & "')"
End If
End With
With e.Form.Controls("combobox3")
If .Value IsNot Nothing Then
Filter &= " and 中国地区 = '" & .Value & "'"
End If
End With
Tables("查询表").Filter = Filter
我只想让红色代码部分组合使用,不影响其它条件,谢谢!