用这个代码绝对没问题
Dim Filter As String = "1=1"
With e.Form.Controls("combobox1")
If .Value <> Nothing Then
Filter = Filter & " and kl = '" & .Value & "'"
End If
End With
With e.Form.Controls("CheckedComboBox1")
If .Value <> Nothing Then
Filter &= " and nd in ('" & .Value.replace(",", "','") & "')"
End If
End With
With e.Form.Controls("CheckedComboBox2")
If .Value <> Nothing Then
Filter &= " and yxdq in ('" & .Value.replace(",", "','") & "')"
End If
End With
With e.Form.Controls("combobox2")
If .Value <> Nothing Then
Filter = Filter & " and lqpc like '%" & .Value & "%'"
End If
End With
msgbox(filter)
Tables("信息查询表").Filter = Filter