主窗口中,该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 处开始)。
请老师帮忙修改一下,谢谢。