我在窗口开始筛选按钮设置如下代码,用的是外部数据源,可以正常筛选,但点击撤消筛选时没有反应,不能回到筛选前的状态,请老师帮看看是什么问题。
Dim Filter As String
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "支付日期 >= '" & .Value & "'"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "支付日期 <= '" & .Value & "'"
End If
End With
If e.Form.Controls("RadioButton5").Checked = True ' 如果付款状态选择了"已付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "乡镇审核 = 1"
End If
If e.Form.Controls("RadioButton6").Checked = True ' 如果付款状态选择了"未付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "乡镇审核 = 0 Or 乡镇审核 Is Null"
End If
If e.Form.Controls("RadioButton2").Checked = True ' 如果付款状态选择了"已付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "是否结算 = 1"
End If
If e.Form.Controls("RadioButton3").Checked = True ' 如果付款状态选择了"未付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "是否结算 = 0 Or 是否结算 Is Null"
End If
If Filter > "" Then
Tables("S征地记录").DataTable.LoadFilter = Filter
Tables("S征地记录").DataTable.Load
此主题相关图片如下:qq图片20180106170557.png