这是跨表计算的代码:
Dim dr1 As DataRow = e.DataRow
Dim dr2 As DataRow
If e.DataCol.Name = "客户" Then
Dim Sum As Double
if e.datarow("生产进度")="已计划" then
Sum = DataTables("生产清单").Compute("Sum(重量)","[客户] = '" & dr1("客户") & "'And [颜色编号]='" & dr1("颜色编号") & "'And [幅宽] = " & dr1("幅宽") & "And [克重] = '" & dr1("克重") & "'")
e.DataRow("生产数量") = Sum
end if
End If
自动更新的代码
if e.datacol.name="重量" then
dim dr as datarow=e.datarow
dim dr1 as datarow
dim dr2 as datarow
Dim s1 As String = "[克重] = " & dr("克重") & " And [颜色编号] = '" & dr("颜色编号") & "' And [客户] = '" & dr("客户") & "' And [幅宽] = " & dr("幅宽")
dr1=datatables("订单管理").find(s1)
dr2=datatables("订单管理").find("[生产进度]='" & "已计划'" & " or [生产进度]='" & "生产中'" & " or [生产进度]='" & "发货中'" )
if dr1 isnot nothing and dr2 isnot nothing then
datatables("订单管理").datacols("客户").RaiseDataColChanged(dr1)
end if
end if
下午查了一下午,都要抓狂了,请版主看下哪里有问题,谢谢
[此贴子已经被作者于2009-8-31 22:43:32编辑过]