-- 作者:czy
-- 发布时间: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
不知道是不是这个要求?
|