-- 作者:kevin
-- 发布时间:2012/8/31 12:07:00
-- 请教:多条件筛选的问题
以下代码可以筛选出符合条件的数据.
我想,加一个CheckBox控件,参加筛选,
就是说,如果这个控件选中时,一并查找 "状态"列为True的数据,如果非选中时,则一并查找"状态"列为False的数据
Dim Filter As String With e.Form.Controls("ddbh") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "订单编号 = \'" & .Value & "\'" End If End With With e.Form.Controls("qs") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "订单日期 >= #" & .Value & "#" End If End With With e.Form.Controls("jz") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "订单日期 <= #" & .Value & "#" End If End With If Filter > "" Then Tables("待采购_table1").Filter = Filter End If
|