你说是的这段代码?和你一楼的问题没什么关系啊
Dim r As Row = Tables("单据").Current '定义主表当前行
dim dr as datarow
dim drr as row
dim filter1,filter2 as string
'计算上年同期数
filter1="[存货编号]='" & e.datarow("存货编号") & "' and [单位地区]='" & e.datarow("单位地区") & "' and [日期]<= #" & r("日期").AddMonths(-12) & "#"
'filter1="[存货编号]='" & e.datarow("存货编号") & "' and [日期]<= #" & r("日期").AddMonths(-12) & "#"
filter2="[存货编号]='" & e.datarow("存货编号") & "' and [单位地区]='" & e.datarow("单位地区") & "' and [日期]<= #" & r("日期") & "#"
e.datarow("上年同期实际_数量")= DataTables("单据明细").Compute("Sum(出库_数量)",filter1)
e.datarow("上年同期实际_金额")= DataTables("单据明细").Compute("Sum(出库_金额)",filter1)
e.datarow("本期计划_数量")= DataTables("单据明细").Compute("Sum(本月计划_数量)",filter2)
e.datarow("本期计划_金额")= DataTables("单据明细").Compute("Sum(本月计划_金额)",filter2)
[此贴子已经被作者于2009-10-26 11:09:39编辑过]