Dim T As String = e.form.Controls("textbox1").Value '定义控件的值
Dim Filter As String '定义筛选
For Each dc As Col In Tables("收款登记").Cols '遍历表的所有列
If dc.DataCol.IsDate OrElse dc.DataCol.IsBoolean OrElse dc.DataCol.IsNumeric Then '如果是时间列,逻辑列,数值列
Continue For '排除
End If
If Filter > "" Then
Filter = Filter & " Or "
End If
Filter = Filter & "[" & dc.Name & "] Like '*" & T & "*'" '根据控件值迷糊筛选
With e.Form.Controls("起始日期")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "收款日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("终止日期")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "收款日期 <= #" & .Value & "#"
End If
End With
If Filter > "" Then
Tables("收款登记").Filter = Filter '将数据筛选出来
End If
Next
Tables("收款登记").Filter = Filter '将数据筛选出来
DataTables("收款登记").LoadFilter= Filter
DataTables("收款登记").load
Dim s As Table = Tables("收款登记")
Dim g As Subtotalgroup
s.SubtotalGroups.Clear()
s.GroupAboveData = False
s.TreeVisible = False
s.SpillNode = True
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "收款日期"
g.TotalOn = "实收金额,折合人民币"
g.Caption = "{0}月 小计"
g.DateGroup = DateGroupEnum.Month
s.SubtotalGroups.Add(g)
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "收款日期"
g.TotalOn = "实收金额,折合人民币"
g.Caption = "{0}月 累计"
g.DateGroup = DateGroupEnum.Month
g.upto = True
s.SubtotalGroups.Add(g)
s.Subtotal()
此主题相关图片如下:qq图片20131223165654.jpg