以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 怎样满足一个条件即可出结果 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=70430) |
-- 作者:qqking -- 发布时间:2015/6/21 18:16:00 -- 怎样满足一个条件即可出结果 老师,这段代码要满足三个条件才能出结果,怎样满足一个就可以出结果 Dim Filter As String With RibbonTabs("cxfx").Groups("zhcx").Items("xjjg") If .text IsNot Nothing Then Filter = "县联社 = \'" & .text & "\'" End If End With With RibbonTabs("cxfx").Groups("zhcx").Items("dkfs") If .text IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "贷款方式 = \'" & .text & "\'" End If End With With RibbonTabs("cxfx").Groups("zhcx").Items("fxxt") If .text IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "贷款形态 = \'" & .text & "\'" End If If Filter > "" Then Tables("dkye").Filter = Filter End If
|
-- 作者:sloyy -- 发布时间:2015/6/21 18:25:00 -- 这是很基础的问题呀 and 改为 or
|
-- 作者:qqking -- 发布时间:2015/6/21 18:32:00 -- 不行了,或许我说错了。意思是满足一个条件或满足一个以上都可以 |
-- 作者:sloyy -- 发布时间:2015/6/21 18:38:00 -- 这段代码本身就是这样设计的,你试试只输入一个或者2个条件,一样可以 [此贴子已经被作者于2015/6/21 18:38:11编辑过]
|
-- 作者:sloyy -- 发布时间:2015/6/21 18:41:00 -- Dim Filter As String filter="" With RibbonTabs("cxfx").Groups("zhcx").Items("xjjg") If .text IsNot Nothing Then Filter = "县联社 = \'" & .text & "\'" End If End With With RibbonTabs("cxfx").Groups("zhcx").Items("dkfs") If .text IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "贷款方式 = \'" & .text & "\'" End If End With With RibbonTabs("cxfx").Groups("zhcx").Items("fxxt") If .text IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "贷款形态 = \'" & .text & "\'" End If If Filter > "" Then Tables("dkye").Filter = Filter End If
|
-- 作者:qqking -- 发布时间:2015/6/21 18:44:00 -- 不行,还是必须录入三个条件才能出结果 |
-- 作者:sloyy -- 发布时间:2015/6/21 18:48:00 -- 哦 这里有问题 RibbonTabs("cxfx").Groups("zhcx").Items("xjjg") 你这是什么? |
-- 作者:qqking -- 发布时间:2015/6/21 18:51:00 -- 菜单组合框 |
-- 作者:sloyy -- 发布时间:2015/6/21 18:52:00 -- 没问题呀 [此贴子已经被作者于2015/6/21 18:53:08编辑过]
|
-- 作者:sloyy -- 发布时间:2015/6/21 18:57:00 -- Val3 =RibbonTabs("方圆置业")("各期明细查询")("银行1").text If Val3 <>"" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "[贷款银行] = \'" & Val3 & "\'" End If Val1 = RibbonTabs("方圆置业")("各期明细查询")("年度1").text Val2 =RibbonTabs("方圆置业")("各期明细查询")("月份1").text If Val1 <>"" And Val2 ="" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "[数据日期] >= " &Val1 & "01 and [数据日期] <= " &Val1 & "12" End If If Val1 <>"" And Val2 <>"" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "[数据日期] = " &Val1 &val2 End If Val6 =RibbonTabs("方圆置业")("各期明细查询")("期数").text If Val6 <>"" Then If Filter > "" Then Filter = Filter & " And " End If If Val6 <6 Then Filter = Filter & "[违约期数] = " & Val6 Else Filter = Filter & "[违约期数] >= " & Val6 End If End If \'DataTables("JKQK").LoadFilter=Filter \'DataTables("JKQK").Load() \'DataTables("联系记录").LoadFilter="" \'DataTables("联系记录").Load() \'DataTables("JKR").LoadFilter="" \'DataTables("JKR").Load() \' Val5 =RibbonTabs("方圆置业")("查询")("姓名").text If Val5 <>"" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "[姓名] like \'%" & Val5 & "%\'" End If Val4 =RibbonTabs("方圆置业")("查询")("帐号").text If Val4 <>"" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "[贷款帐号] = \'" & Val4 & "\'" End If Val7 =RibbonTabs("方圆置业")("查询")("工作单位").text If Val7 <>"" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "[工作单位] like \'%" & Val7 & "%\'" End If Val8 = RibbonTabs("方圆置业")("查询")("抵押物地址").text If Val8 <>"" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "[抵押物地址] like \'%" & Val8 & "%\'" End If Tables("JKQK").Filter=Filter |