以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 时间加列名筛选 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=93104) |
-- 作者:yangwenghd -- 发布时间:2016/11/20 21:56:00 -- 时间加列名筛选 Dim d1 As Date = e.Form.Controls("DateTimePicker1").Value If d1 = Nothing Then d1 = Date.Today Dim filter1 As String = "" If e.Form.Controls("RadioButton1").Checked Then filter1 = "发货_日期 = #" & d1 & "#" ElseIf e.Form.Controls("RadioButton2").Checked Then Dim w As Integer = d1.DayOfWeek \'算出今天是星期几 Dim dt1 As Date = d1.AddDays(0 - w) \'获取本周的第一天 ,星期一到星期天 Dim dt2 As Date = d1.AddDays(6 - w) \'获取本周的最后一天 filter1 = "发货_日期 >= #" & dt1 & "# and 发货_日期 <= #" & dt2 & "#" End If \'filter1 = filter1 & " And 目录_订单= Controls("ComboBox2").Text Tables("订单").Filter = filter1 能帮忙看看这个吗?再加上 目录_订单 列和 ComboBox2 一样的内容 感谢 感谢
|
-- 作者:yangwenghd -- 发布时间:2016/11/20 22:29:00 -- 为什么是未声明呢?Controls |
-- 作者:有点青 -- 发布时间:2016/11/21 9:01:00 -- Dim d1 As Date = e.Form.Controls("DateTimePicker1").Value If d1 = Nothing Then d1 = Date.Today Dim filter1 As String = "1=1" If e.Form.Controls("RadioButton1").Checked Then filter1 = " and 发货_日期 = #" & d1 & "#" ElseIf e.Form.Controls("RadioButton2").Checked Then Dim w As Integer = d1.DayOfWeek \'算出今天是星期几 Dim dt1 As Date = d1.AddDays(0 - w) \'获取本周的第一天 ,星期一到星期天 Dim dt2 As Date = d1.AddDays(6 - w) \'获取本周的最后一天 filter1 = " and 发货_日期 >= #" & dt1 & "# and 发货_日期 <= #" & dt2 & "#" End If If e.form.Controls("ComboBox2").Text > "" Then filter1 = filter1 & " And 目录_订单= \'" & e.form.Controls("ComboBox2").Text & "\'" End If Tables("订单").Filter = filter1 |