以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  窗口多值组合筛选(ok了)  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=69120)

--  作者:实话实说
--  发布时间:2015/5/30 21:20:00
--  窗口多值组合筛选(ok了)
窗口1[筛选]按钮代码如何组合筛选(规格1是多值)
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:多值筛选.foxdb

[此贴子已经被作者于2015/5/31 7:31:31编辑过]

--  作者:湛江智
--  发布时间:2018/6/6 7:35:00
--  
坛主,正确的代码怎么写的?
--  作者:有点甜
--  发布时间:2018/6/6 8:49:00
--  

参考

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=119635&skin=0

 


--  作者:湛江智
--  发布时间:2018/6/6 9:07:00
--  回复:(有点甜)参考 http://www.foxtable....

型号单选,规格多选筛选ok了

如果要实现,型号也多选,规格也多选,代码怎么修改呢?

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:两列多值筛选,代码怎么修改呢?.foxdb


--  作者:有点甜
--  发布时间:2018/6/6 9:46:00
--  

Dim Filter As String
With e.Form.Controls("型号")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Dim str As String = "1=2"
        For Each s As String In .Value.split(",")
            str &= " or 型号 like \'%" & s & "%\'"
        Next
        Filter = Filter & " (" & str & ") "
    End If
End With
With e.Form.Controls("规格1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Dim str As String = "1=2"
        For Each s As String In .Value.split(",")
            str &= " or 规格 like \'%" & s & "%\'"
        Next
        Filter = Filter & " (" & str & ") "
    End If
End With
If Filter > "" Then
    Tables("表A").Filter = Filter
End If

With e.Form.Controls("规格1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Dim str As String = "1=1"
        For Each s As String In .Value.split(",")
            str &= " and 规格 like \'%" & s & "%\'"
        Next
        Filter = Filter & " (" & str & ") "
    End If
End With


--  作者:湛江智
--  发布时间:2018/6/6 10:05:00
--  回复:(有点甜)Dim Filter As StringWith e.Form.Co...

堂主,选择型号a和BV后,规格要下拉多选显示1.5  2.5 4 代码怎么写呢?


图片点击可在新窗口打开查看此主题相关图片如下:捕获.jpg
图片点击可在新窗口打开查看

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:两列多值筛选,代码怎么修改呢?.foxdb

[此贴子已经被作者于2018/6/6 10:05:52编辑过]

--  作者:有点甜
--  发布时间:2018/6/6 10:14:00
--  

参考

 

http://www.foxtable.com/webhelp/scr/1523.htm

 


--  作者:有点甜
--  发布时间:2018/6/6 10:19:00
--  
Dim Filter As String
With e.Form.Controls("型号")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Dim str As String = "1=2"
        For Each s As String In .Value.split(",")
            str &= " or 型号 like \'%" & s & "%\'"
        Next
        Filter = Filter & " (" & str & ") "
    End If
End With
Dim cmb As WinForm.CheckedComboBox
cmb = e.Sender
If filter = "" Then
    cmb.ComboList = DataTables("表A").GetComboListString("规格")
Else
    cmb.ComboList = DataTables("表A").GetComboListString("规格", filter)
End If

--  作者:湛江智
--  发布时间:2018/6/6 10:47:00
--  回复:(有点甜)Dim Filter As StringWith e.Form.Co...

型号输入b,再选址规格,筛选不对。BV型号的规格也筛选出来了

下面代码还是不行,怎么修改呢?

Dim Filter As String
With e.Form.Controls("型号")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Dim str As String = "1=2"
        For Each s As String In .Value.split(",")
            str &= " or 型号 = \'%" & s & "%\'"
        Next
        Filter = Filter & " (" & str & ") "
    End If
End With
Dim cmb As WinForm.CheckedComboBox
cmb = e.Sender
If filter = "" Then
    cmb.ComboList = DataTables("表A").GetComboListString("规格")
Else
    cmb.ComboList = DataTables("表A").GetComboListString("规格", filter)
End If


图片点击可在新窗口打开查看此主题相关图片如下:捕获.jpg
图片点击可在新窗口打开查看


--  作者:有点甜
--  发布时间:2018/6/6 10:50:00
--  

str &= " or 型号 like \'%" & s & "%\'"

 

改成

 

str &= " or (\',\' + 型号 + \',\') like \'%," & s & ",%\'"