如图,我要在筛选过程中进行自定义汇总,如何使得“年份”不用汇总,同时只有选择科目的时候才进行总计,科目不选就没有总计
此主题相关图片如下:3333.jpg
![dvubb 图片点击可在新窗口打开查看](UploadFile/2015-12/2015121016585232860.jpg)
Dim Filter As String '设置筛选条件
With e.Form.Controls("DW")
If .Value IsNot Nothing Then
Filter = "所属单位 = '" & .Value & "'"
End If
End With
With e.Form.Controls("NF")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "年 = '" & .Value & "'"
End If
End With
With e.Form.Controls("KM")
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
Dim t As Table = Tables("损益进度(总体)")
Dim g As Subtotalgroup
Dim cs As String = ""
For Each c As Col In Tables("损益进度(总体)").cols
If c.Visible AndAlso c.IsNumeric Then
cs &= c.name & ","
End If
Next
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = False
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
g.TotalOn = cs.trim(",")
g.Caption = "总计"
t.SubtotalGroups.Add(g)
t.Subtotal()