如下图所示
此主题相关图片如下:截图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

望指教。。