以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]日历控件多选 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=151199) |
-- 作者:天一生水 -- 发布时间:2020/6/17 19:56:00 -- [求助]日历控件多选 老师好! 我想按住Ctrl键,连续选中多个日期,对表格进行日期筛选,请老师帮助看一下代码需要怎样修改? 谢谢! Dim Filter As String For Each nm As String In lst |
-- 作者:有点蓝 -- 发布时间:2020/6/18 9:12:00 -- Dim Filter As String Dim str As String ="" Static lst As List(of Date) \'定义一个静态集合变量,用于存储选择的日期 If lst Is Nothing Then lst = New List(of Date) End If If ModifierKey <> Keys.Control Then \'如果没有按下Ctrl键 lst.Clear() \'清除以前的日期 End If If lst.Contains(e.Sender.Value) = False Then \'如果集合不包括按下的日期 lst.Add(e.Sender.Value) \'则向集合添加此日期 End If For Each nm As Date In lst str &= format(nm,"yyyy-MM-dd") & "," Next str = str.Trim(",") Filter = "第一列 In (\'" & str.Replace(",", "\',\'") & "\')" msgbox(Filter ) Tables("表A").Filter = Filter
|