以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  从字符串“”到类型“Date”的转换无效。  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=169642)

--  作者:cnsjroom
--  发布时间:2021/6/24 11:04:00
--  从字符串“”到类型“Date”的转换无效。
Dim txt As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")
With Tables("党史教育学习台账")
    If txt.Value = "" Then
        .Filter = ""
    Else
        .Filter = "时间 =\'" & txt.text & "\'"
    End If
End With

运行提示从字符串“”到类型“Date”的转换无效。

--  作者:有点蓝
--  发布时间:2021/6/24 11:17:00
--  
With Tables("党史教育学习台账")
    If txt.Value = nothing Then
        .Filter = ""
    Else
        .Filter = "时间 =#" & txt.Value & "#"
    End If
End With