以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- DropBox1进行筛选 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=188646) |
-- 作者:蓝蚂蚁 -- 发布时间:2023/10/9 8:25:00 -- DropBox1进行筛选 主窗口中,该DropBox控件的TextChanged代码: Dim drp As WinForm.DropDownBox = e.sender If drp.DroppedDown Then Dim tbl As Table = Tables("处方编号弹出小窗口_Table1") If drp.Text = "" Then tbl.Filter = "" Else \'否则根据输入内容进行模糊筛选 Dim txt As String = "\'%" & drp.Text & "%\'" tbl.Filter = "姓名 Like " & txt & " Or NO Like " & txt End If End If 该代码能正常筛选出来。 但我想在主窗口中增加两个时间控件,要求筛选出来的数据在该时间段内的,代码修改如下: Dim d1 As Date=forms("未领*处方登记录入小窗口").controls("DateTimePicker1").value Dim d2 As Date=forms("未领*处方登记录入小窗口").controls("DateTimePicker2").value Dim drp As WinForm.DropDownBox = e.sender If drp.DroppedDown Then \'如果下拉窗口已经打开 Dim tbl As Table = Tables("处方编号弹出小窗口_Table1") If drp.Text = "" Then tbl.Filter = "" Else \'否则根据输入内容进行模糊筛选 Dim txt As String = "\'%" & drp.Text & "%\'" tbl.Filter ="日期>=#"& d1 &" And 日期<=#"& d2 &"# And (姓名 Like " & txt & " Or NO Like " & txt &")" End If End If 在DropBox1输入内容时弹出错误提示: 该字符串未被识别为有效的 DateTime。有一个未知单词(从索引 11 处开始)。 请老师帮忙修改一下,谢谢。 |
-- 作者:有点蓝 -- 发布时间:2023/10/9 8:32:00 -- 参考这里的方法合成筛选条件:http://www.foxtable.com/webhelp/topics/1058.htm |