去掉ValueChanged事件代码
在TextChanged事件写代码 |
Dim Filter As String
Dim btn3 As WinForm.DateTimePicker =e.Form.Controls("StartDate")
Dim btn4 As WinForm.DateTimePicker = e.Form.Controls("EndDate")
Select Case e.Form.Controls("选择").Text
Case "全部"
btn3.Enabled = True
btn4.Enabled = True
btn3.Value = Nothing
btn3.Value = Nothing
Case "今天"
btn3.Value = Date.Today
btn3.Value = Date.Today
Filter = "时间 = '" & Date.Today & "'"
Case "本周"
Dim w As Integer = Date.Today.DayOfWeek '算出今天是星期几
Dim dt1 As Date = Date.Today.AddDays(-w) '获取本周的第一天
Dim dt2 As Date = Date.Today.AddDays(6 - w) '获取本周的最后一天
btn3.Value = dt1
btn3.Value = dt2
Filter = "时间 >= '" & dt1 & "' And 时间 <= '" & dt2 & "'"
End Select
Tables("订单管理").Filter = Filter