以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 复选组合框筛选 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=11010) |
-- 作者:blackzhu -- 发布时间:2011/7/4 14:02:00 -- 复选组合框筛选 Dim Vals() As String = e.Form.Controls("CheckedComboBox1").Value.Split(",") For Val As Integer = 0 To Vals.Length - 1 If Vals(Val) IsNot Nothing Then Filter = "客户编号 = \'" & Vals(Val) & "\'" End If Next 上面的代码我怎么改,只能筛选后一个值,不能两个值同时筛选 |
-- 作者:blackzhu -- 发布时间:2011/7/4 14:09:00 -- 相当于菜单中选择筛选道理一样. |
-- 作者:hhbb -- 发布时间:2011/7/4 14:11:00 -- Dim Ft As String Dim Vals() As String = e.Form.Controls("CheckedComboBox1").Value.Split(",") For Val As Integer = 0 To Vals.Length - 1 Ft+ = ",\'" & Vals(Val) & "\'" Next Tables("XXX"). Filter = "客户编号 In (" & Ft.substring(1) & ")"
[此贴子已经被作者于2011-7-4 14:12:33编辑过]
|
-- 作者:blackzhu -- 发布时间:2011/7/4 14:29:00 -- 出错,提示 , 前面缺少操作符,但是还是筛选了.而且我是多重筛选,底下还有 With e.Form.Controls("CheckedComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "合同编号 = \'" & .Value & "\'" End If End With 筛选合同编号,时间等代码
|
-- 作者:blackzhu -- 发布时间:2011/7/4 15:08:00 -- 老大看看. |
-- 作者:狐狸爸爸 -- 发布时间:2011/7/4 15:11:00 -- Dim Ft As String ft = e.Form.Controls("CheckedComboBox1").Value Tables("XXX"). Filter = "客户编号 In (" & Ft & ")" |
-- 作者:blackzhu -- 发布时间:2011/7/4 15:29:00 -- 不行:我的代码是这样的: Dim Filter As String With e.Form.Controls("CheckedComboBox1") Dim Vals() As String = e.Form.Controls("CheckedComboBox1").Value.Split(",") For Val As Integer = 0 To Vals.Length - 1 If Vals(Val) IsNot Nothing Then Filter = "客户编号 = \'" & Vals(Val) & "\'" End If Next End With \'我的意思是红色这一部分可以做到多值选择筛选,但是万一只要选择一个值时可以跟后面的代码一起起到多重筛选. With e.Form.Controls("CheckedComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "合同编号 = \'" & .Value & "\'" End If End With With e.Form.Controls("DateTimePicker1") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "本期起息日 >= #" & .Value & "#" End If End With With e.Form.Controls("DateTimePicker2") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "本期结息日 <= #" & .Value & "#" End If End With If Filter > "" Then Tables("利息").Filter = Filter Tables("查询_Table1").Filter = Filter End If |
-- 作者:狐狸爸爸 -- 发布时间:2011/7/4 15:34:00 -- Dim Filter As String If e.Form.Controls("CheckedComboBox1").Value IsNot Nothing Then Filter = "客户编号 In (" & e.Form.Controls("CheckedComboBox1").Value & ")" End If \'其余代码 |
-- 作者:blackzhu -- 发布时间:2011/7/4 15:43:00 -- 老大,红色部分不行. |
-- 作者:狐狸爸爸 -- 发布时间:2011/7/4 15:44:00 -- 红色不要,改为8楼 |