我设计了一个窗口重新进行汇总,但是窗口中的表生成不了汇总
代码如下
Dim filter1 As String
filter1="客户名称= '" & e.Form.Controls("ComboBox1").value & "'" & " And 加工日期 >= #" & e.Form.Controls("startdate").value & "# " & " And 加工日期 <= #" & e.Form.Controls("enddate").value & "# "
Dim g As New sqlgroupTableBuilder("统计表1", "加工单")
g.C
g.Groups.AddDef("加工日期", "月份")
g.Groups.AddDef("款型及款号")
g.Totals.AddDef("件重")
g.Totals.AddDef("件数")
g.Totals.AddDef("单价")
g.Totals.AddDef("金额")
g.VerticalTotal = True
g.SubTotal = True
g.filter=filter1
g.Build()
''重新生成汇总
Dim t As Table = Tables("统计表1")
Dim g1 As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = True
g1 = New Subtotalgroup
g1.Aggregate = AggregateEnum.Sum
g1.GroupOn = "月份"
g1.TotalOn = "件数,金额"
g1.Caption = "{0}月 小计"
g1.DateGroup = DateGroupEnum.Month
t.SubtotalGroups.Add(g1)
g1 = New Subtotalgroup
g1.Aggregate = AggregateEnum.Sum
g1.GroupOn = "*"
g1.TotalOn = "件数,金额"
g1.Caption = "总计"
t.SubtotalGroups.Add(g1)
t.Subtotal()''
Tables(e.form.Name & "_Table1").DataSource =DataTables("统计表1")
Tables(e.form.Name & "_Table1").SetColVisibleWidth("月份|60|款型及款号|280|件重|100|件数|100|单价|100|金额|100")
Tables(e.form.Name & "_Table1").DataTable.DataCols("金额").SetFormat("0.00")
Tables(e.form.Name & "_Table1").Cols("月份").TextAlign = TextAlignEnum.Center
不知道错在哪里 ?