请教老师:
下面代码中用绿色的行正确,黃色行错误,为什么?如何才能用黃色的代码?
DataTables("业务流程表").LoadFilter = ""
DataTables("业务流程表").load
Forms("奖金核算窗口").Controls("Label1").Text = "奖金核算"
Dim d1 As fxDataSource
Dim jb1 As New SQLJoinTableBuilder("查询表1","业务流程表")
jb1.C
jb1.AddTable("业务流程表","奖金代码","奖金方案表","奖金代码")
jb1.AddExp("姓名","检验主检")
jb1.AddCols("报告编号")
jb1.AddExp("工作性质","case when 检验主检 is null Then '无' Else '主检' End")
jb1.AddExp("金额","检验奖金额")
jb1.AddExp("定额","检验工时定额")
jb1.Filter = "检验主检 <> ''"
Dim jb2 As New SQLJoinTableBuilder("查询表2","业务流程表")
jb2.C
jb2.AddTable("业务流程表","奖金代码","奖金方案表","奖金代码")
jb2.AddExp("姓名","检验辅检")
jb2.AddCols("报告编号")
jb2.AddExp("工作性质","case when 检验辅检 is null Then '无' Else '辅检' End")
jb2.AddExp("金额","检验奖金额 * 0.5")
jb2.AddExp("定额","检验工时定额")
jb2.Filter = "检验辅检 <> ''"
Dim jb3 As New SQLJoinTableBuilder("查询表3","业务流程表") '查询表生成器
jb3.C
jb3.AddTable("业务流程表","奖金代码","奖金方案表","奖金代码") '添加关联表
jb3.AddExp("姓名","文审主审")
jb3.AddCols("报告编号")
jb3.AddExp("工作性质","case when 文审主审 is null Then '无' Else '文审' End")
jb3.AddExp("金额","文审奖金额")
jb3.AddExp("定额","文审工时定额")
jb3.Filter = "文审主审 <> ''"
jb1.Union(jb2,True) '组合jb2
jb1.Union(jb3,True) '组合jb3
jb1.Build(True)
'Dim b1 As New GroupTableBuilder("统计表1",DataTables("查询表1")) '分组统计表生成器
Dim b1 As New SQLGroupTableBuilder("统计表1","查询表1") '后台数据分组统计
b1.Groups.AddDef("姓名") '添加列用于水平分组
b1.Totals.AddDef("金额") '添加数量列用于统计
b1.Totals.AddDef("定额") '添加数量列用于统计
d1 = b1.BuildDataSource()
Tables("奖金核算窗口_Table2").DataSource = d1
Tables("奖金核算窗口_Table2").Cols("金额").GrandTotal = True
Tables("奖金核算窗口_Table2").Cols("定额").GrandTotal = True
Tables("奖金核算窗口_Table2").GrandTotal = True '显示合计模式
Tables("奖金核算窗口_Table2").AutoSizeCols() '自动列宽
Tables("奖金核算窗口_Table2").SetHeaderRowHeight(30,30) '表头行高
'Tables("奖金核算窗口_Table2").Sort = "检验主检"