以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 撤消筛选没反应 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=113004) |
-- 作者:aza520 -- 发布时间:2018/1/6 17:06:00 -- 撤消筛选没反应 我在窗口开始筛选按钮设置如下代码,用的是外部数据源,可以正常筛选,但点击撤消筛选时没有反应,不能回到筛选前的状态,请老师帮看看是什么问题。 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 |
-- 作者:有点蓝 -- 发布时间:2018/1/6 17:12:00 -- DataTable.Load是重新加载,而不是筛选,无法撤销,自能重新设置条件重新加载。 你可以用一个全局变量记录上一次加载的条件,比如 If Filter > "" Then vars("条件") = Tables("S征地记录").DataTable.LoadFilter Tables("S征地记录").DataTable.LoadFilter = Filter Tables("S征地记录").DataTable.Load 那么撤销这样 Tables("S征地记录").DataTable.LoadFilter = vars("条件") Tables("S征地记录").DataTable.Load |