以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于筛选  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88794)

--  作者:mark96
--  发布时间:2016/8/9 16:51:00
--  关于筛选
请问我怎么能用组合框筛选出列名,然后根据这个列名继续筛选数据呢?
--  作者:大红袍
--  发布时间:2016/8/9 17:27:00
--  

参考代码

 

Dim cs As String = ""
For Each c As Col In Tables("表A").cols
    cs &= c.name & "|"
Next
e.form.controls("ComboBox1").combolist = cs.trim("|")


--  作者:大红袍
--  发布时间:2016/8/9 17:30:00
--  

查询代码

 

Dim cn As String = e.form.controls("ComboBox1").Text
Tables("表A").filter = cn & " = \'" & e.form.controls("TextBox1").Text & "\'"


--  作者:mark96
--  发布时间:2016/8/9 17:33:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.table


--  作者:大红袍
--  发布时间:2016/8/9 18:05:00
--  
Dim Filter As String
Dim lm As String = Forms("窗口1").Controls("ComboBox1").text
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "第一列 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "第一列 <= #" & .Value & "#"
    End If
End With
With e.Form.Controls("TextBox1")
    If .Value IsNot Nothing AndAlso lm > "" Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & lm & " >= \'" & .Value & "\'"
    End If
End With

If Filter > "" Then
    Tables("表A").Filter = Filter
End If