在统计表的AfterLoad中有以下代码,打开时出现以下错误提示,各种偿试都不行
.NET Framework 版本:2.0.50727.9151
Foxtable 版本:2018.10.9.1
错误所在事件:统计表,AfterLoad
详细错误信息:
未设置对象变量或 With 块变量。
Dim t As Table = Tables("统计表")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = True
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "主体"
g.TotalOn = "销售额,工资总额"
g.Caption = "{0}
小计"
t.SubtotalGroups.Add(g)
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "年份"
g.TotalOn = "销售额,工资总额"
g.Caption = "{0}
小计"
t.SubtotalGroups.Add(g)
t.Sort = "主体,年份,月份"
t.Subtotal(true)
Dim r As Row
For i As Integer = 0 To Tables("统计表").Rows.Count(True) - 1
r = Tables("统计表").Rows(i,True)
If r.IsGroup AndAlso r.level = 1 Then '汇总行计算
Dim s21 As Double = DataTables("统计表").SQLCompute("sum([销售额])","[主体]
= '" & r("主体").replace("小计","").trim()
& "'")
If s21 <> 0
r("工资占比") = DataTables("统计表").SQLCompute("sum([工资总额])","[主体]
= '" & r("主体").replace("小计","").trim()
& "'")/s21
End If
End If
If r.IsGroup AndAlso r.level = 0 Then
Dim s31 As Double = DataTables("统计表").SQLCompute("sum([销售额])","[年份]
= '" & r("主体").replace("小计","").trim()
& "'")
If s31 <> 0
r("工资占比") = DataTables("统计表").SQLCompute("sum([工资总额])","[年份]
= '" & r("主体").replace("小计","").trim()
& "'")/s31
End If
End If
Next
另外在MainTableChanged已设置了以下代码
If MainTable.Name = "统计表" Then
DataTables("统计表").load
End If