以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  时间段的筛选  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=39715)

--  作者:owenlyx
--  发布时间:2013/8/30 21:40:00
--  时间段的筛选

如下图所示


 
此主题相关图片如下:截图02.jpg
按此在新窗口浏览图片

 

想在DATATIMEPICKER控件红输入开始日期和结束日期,然后点击按钮[销售查询] 按时间筛选, 我的代码下:

 

 

If e.Form.Controls("开始日期").Value = ""
    MessageBox.show("请选择开始时间")
    Return
End If
If e.Form.Controls("结束日期").Value = ""
    MessageBox.show("请选择结束时间")
    Return
End If


Dim jsrq As WinForm.DateTimePicker = e.Form.Controls("结束日期")
Dim ksrq As WinForm.DateTimePicker = e.Form.Controls("开始日期")
Dim StartDate As Date = e.Form.Controls("开始日期").Value
Dim EndDate As Date = e.Form.Controls("结束日期").Value
StartDate = StartDate.AddDays(-1)
EndDate = EndDate.AddDays(+1)
Dim Filter As String = "销售日期 > #" & StartDate & "# and  销售日期 < #" & EndDate & "#"

Tables("总销售查询_销售表").Filter = Filter

 

报错如下:

 


此主题相关图片如下:截图01.jpg
按此在新窗口浏览图片

 

望指教。。

 



 


--  作者:有点甜
--  发布时间:2013/8/30 21:44:00
--  
 改成 e.Form.Controls("结束日期").Value is nothing
--  作者:owenlyx
--  发布时间:2013/8/31
--  

改过了,还是一样的不行,这个好像是数据类型的问题吧 ?


--  作者:Bin
--  发布时间:2013/8/31 8:57:00
--  
空值不能转换为日期类型.