改一下代码
Dim Filter As String
With e.Form.Controls("序号1")
If .Value IsNot Nothing Then
Filter = "序号 = '" & .Value & "'"
End If
End With
With e.Form.Controls("年度1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "年度 in ('" & .Value.replace(",", "','") & "')"
End If
End With
With e.Form.Controls("季度1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "季度 in ('" & .Value.replace(",", "','") & "')"
End If
End With
With e.Form.Controls("道路名称1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "道路名称 in ('" & .Value.replace(",", "','") & "')"
End If
End With
With e.Form.Controls("隐患地名1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "隐患地名 = '" & .Value & "'"
End If
End With
If e.Form.Controls("yizhenggai").Checked = True ' 如果付款状态选择了"已整改"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "是否整改 = True"
End If
If e.Form.Controls("quanbu").Checked = True ' 如果付款状态选择了"全部" Then
Tables("道路隐患表").ApplyFilter = False
End If
If e.Form.Controls("weizhenggai").Checked = True ' 如果付款状态选择了"未整改"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "是否整改 = False Or 是否整改 Is Null"
End If
If Filter > "" Then
Tables("道路隐患表").Filter = Filter
End If