Dim a As Date=Vars("mydate")
Dim b As String=a.Year
Dim c As String=a.Month
Dim d As String=a.Day
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("fdc"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("ch")
bd1.Totals.AddDef("cs")
bd1.Totals.AddDef("je")
bd1.Filter="[rq] > #(b & "-" & c & "-" & d)#" 按日期筛选
运行到上一句就出错
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("jyb"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("ch")
bd2.Totals.AddDef("yl")
bd2.Totals.Adddef("je","金额")
bd2.Filter="[rq] > #2011-11-30#"
dt2 = bd2.BuildDataSource()
dt1.Combine("ch",dt2,"ch")
dt1.Show("统计表1")
Tables("统计表1").Sort = "ch"
DataTables("统计表1").DataCols("je").SetFormat ("0.00")
DataTables("统计表1").DataCols("yl").SetFormat ("0")
DataTables("统计表1").DataCols("金额").SetFormat ("0.00")
DataTables("统计表1").DataCols.Add("应付款", Gettype(Single), "[je] - [金额]")
DataTables("统计表1").DataCols("应付款").SetFormat ("0.00")
Tables("统计表1").SetColVisibleWidth("ch|60|cs|60|je|80|yl|70|金额|80|应付款|80")
MainTable = Tables("统计表1")
Dim t As Table = Tables("统计表1")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = True
t.TreeVisible = True
t.SpillNode = True
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
g.TotalOn = "cs,je,yl,金额,应付款"
g.Caption = "总计"
t.SubtotalGroups.Add(g)
t.Subtotal()
[此贴子已经被作者于2012-4-6 15:22:59编辑过]