以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 多条件筛选不成功 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=131165) |
-- 作者:蓝蚂蚁 -- 发布时间:2019/2/19 10:08:00 -- 多条件筛选不成功 Dim Filter As String With e.Form.Controls("TextBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "通用名称 like \'%" & .Value & "%\'" End If End With With e.Form.Controls("TextBox7") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Dim nf As String=e.Form.Controls("TextBox7").text Dim nfd1 As Date Dim nfd2 As Date If nf.Length=4 Then nfd1 = new Date(nf.SubString(0,4),1,1) nfd2=nfd1.AddYears(1) Filter ="来货日期 >=#"& nfd1 &"# And 来货日期 <#"& nfd2 &"#" Else MessageBox.Show("年份位数不对,只能4位数!", "提示") End If End If End With Tables("窗口_Table1").Filter = Filter 上面的代码中TextBox2 和TextBox7 同时输入查询条件时,筛查不出想要的记录。烦老师帮看看代码哪里有问题?
|
-- 作者:有点蓝 -- 发布时间:2019/2/19 10:35:00 -- Filter =Filter & "来货日期 >=#"& nfd1 &"# And 来货日期 <#"& nfd2 &"#" |