以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助] (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=145753) |
||||
-- 作者:HANZHIGANG -- 发布时间:2020/2/6 16:49:00 -- [求助] 如何使用菜单中的多个文本框查询对对应的表进行筛选
|
||||
-- 作者:有点蓝 -- 发布时间:2020/2/6 16:59:00 -- 参考:http://www.foxtable.com/webhelp/topics/1058.htm,更改取值的地方即可 Dim Filter As String With RibbonTabs("功能区1").Groups("功能组1").Items("文本框1") If .text > "" Then Filter = "车号 = \'" & .text & "\'" End If End With With RibbonTabs("功能区1").Groups("功能组1").Items("日期输入框1") If .value <> Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "调度日期 >= #" & .value & "#" End If End With If Filter > "" Then Tables("表A").Filter = Filter End If |
||||
-- 作者:HANZHIGANG -- 发布时间:2020/2/6 19:21:00 -- Dim Filter As String With RibbonTabs("运次借款").Groups("查询区").Items("车牌号") If .text > "" Then Filter = "车牌号 like \'%" & .text & "%\'" End If End With With RibbonTabs("运次借款").Groups("查询区").Items("借款单号") If .text > "" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "借款单号 like \'%" & .text & "%\'" End If End With With RibbonTabs("运次借款").Groups("查询区").Items("调度单号") If .text > "" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "调度单号 like \'%" & .text & "%\'" End If End With With RibbonTabs("运次借款").Groups("查询区").Items("借自") If .value <> Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "操作时间 >= #" & .value & "#" End If End With With RibbonTabs("运次借款").Groups("查询区").Items("借至") If .value <> Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "操作时间 <= #" & .value & "#" End If End With If Filter > "" Then Tables("运次借款").DataTable.loadfilter = Filter Tables("运次借款").DataTable.load Else Tables("运次借款").DataTable.loadfilter = "" Tables("运次借款").DataTable.load End If 老师,以上是我提问后按您指导改写后的代码,其他都没问题,只是操作时间在查询时有个问题:比如,列内有个时期是2019-12-10,我在菜单查询这个时间段时,两个输入框分别填入2019-12-09和2019-12-11可出结果,但如果都填入2019-12-10则查询为空,不知为什么?请指导一下 测试的那个不存在这个问题
[此贴子已经被作者于2020/2/6 19:37:20编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2020/2/7 9:39:00 -- Filter = Filter & "操作时间 < #" & .value.adddays(1) & "#" |