以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]列表框做窗口筛选问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=93377)

--  作者:小巫仙
--  发布时间:2016/11/26 21:18:00
--  [求助]列表框做窗口筛选问题
请问大神,想做个窗口筛选,其中有三个ComboBox,每个对应表中的一列,想实现三个combobox每个做了选择后其他两个的列表选项只剩下筛选后的集合,如果是单一结果直接显示在列表框里
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.rar



--  作者:wyz20130512
--  发布时间:2016/11/26 21:23:00
--  回复:(小巫仙)[求助]列表框做窗口筛选问题
http://www.foxtable.com/webhelp/scr/1523.htm
--  作者:小巫仙
--  发布时间:2016/11/27 20:07:00
--  
你好,我看过这个示例。但是这个示例必须得从第一个combobox开始选择,我想三个combobox是并列关系,先选哪一个另外两个都可以有筛选,而且当筛选完的符合项只有一项时直接显示在combobox中
--  作者:小巫仙
--  发布时间:2016/11/27 20:25:00
--  
求大神帮帮忙
--  作者:有点色
--  发布时间:2016/11/27 20:37:00
--  

参考代码

 

Dim cmb As WinForm.ComboBox
cmb = Forms("窗口1").Controls("ComboBox1")
Dim cmb1 As WinForm.ComboBox
cmb1 = Forms("窗口1").Controls("ComboBox2")
Dim cmb2 As WinForm.ComboBox
cmb2 = Forms("窗口1").Controls("ComboBox3")
Dim filter As String = "1=1"
If cmb.Text > "" Then
    filter &= " and 序号 = \'" & cmb.Text & "\'"
End If
If cmb1.Text > "" Then
    filter &= " and 班组 = \'" & cmb1.Text & "\'"
End If
If cmb2.Text > "" Then
    filter &= " and 姓名 = \'" & cmb2.Text & "\'"
End If
cmb.ComboList = DataTables("表A").GetComboListString("序号", filter)
cmb1.ComboList = DataTables("表A").GetComboListString("班组", filter)
cmb2.ComboList = DataTables("表A").GetComboListString("姓名", filter)
If cmb.ComboList.Split("|").length = 1 Then
    cmb.text = cmb.ComboList
End If
If cmb1.ComboList.Split("|").length = 1 Then
    cmb1.text = cmb1.ComboList
End If
If cmb2.ComboList.Split("|").length = 1 Then
    cmb2.text = cmb2.ComboList
End If


--  作者:小巫仙
--  发布时间:2016/11/29 9:27:00
--  
超级棒呀大神!虽然不知道代码的意思但是实现我想要的啦!谢谢啦!