Foxtable(狐表)用户栏目专家坐堂 → [求助]目录树与组合框筛选联动的问题


  共有2856人关注过本帖树形打印复制链接

主题:[求助]目录树与组合框筛选联动的问题

帅哥哟,离线,有人找我吗?
czy
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章 三级勋章 二级勋章
等级:超级版主 帖子:6318 积分:33957 威望:0 精华:10 注册:2008/8/31 20:56:00
  发帖心情 Post By:2014/11/1 21:15:00 [显示全部帖子]

目录树事件改成这样

 

Dim trv As WinForm.TreeView = e.Sender
Dim flt As String
For Each nd As WinForm.TreeNode In e.node.Nodes '清除子节点选中状态
    nd.Checked = False
Next
If e.node.ParentNode IsNot Nothing Then '去掉父节点选中状态
    e.node.ParentNode.Checked = False
End If
For Each nd As WinForm.TreeNode In trv.AllNodes
      If nd.Checked Then
        If flt > "" Then
            flt = flt & " Or "  '注意用or而不是And
        End If
        If nd.Level = 0 Then '注意下面的条件都要用括号括起来
            flt = flt & "( 系列名称 = '" & nd.Text & "')"
        Else
            flt = flt & "( 系列名称= '" & nd.ParentNode.Text & "' And 种类名称 = '" & nd.Text & "')"
        End If
    End If   
Next
Tables("出库查询_Table1").Filter = flt

 

开始查询改成这样

 

Dim Filter As String = ""
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
If Tables("出库查询_Table1").Filter <> ""
    Tables("出库查询_Table1").Filter = Tables("出库查询_Table1").Filter & "and " & Filter
Else
    Tables("出库查询_Table1").Filter = Filter
End If
e.Form.Controls("TextBox1").Text = Tables("出库查询_Table1").Rows.Count

 

不知道是不是这个要求?


 回到顶部