以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  修改  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=84831)

--  作者:woshiabc
--  发布时间:2016/5/11 15:15:00
--  修改
副本表1是主表,副本表2是明细表,关联字段为“编号”
副本表2的跨表计算,对表2的每一行的“运费”列——
B的运费=B的总体积/A的总体积*A的总共运费
If Tables("窗口_Table1").Cols("总体积") > 0 Then
    For Each a As Row In Tables("窗口_Table2")
        a.Cols("运费") = a.Cols("总体积")/Tables("窗口_Table1").Cols("总体积") * Tables("窗口_Table1").Cols("运费")
    Next
Else
    Tables("窗口_Table2").cols("运费") = Nothing
End If


--  作者:大红袍
--  发布时间:2016/5/11 15:25:00
--  
Dim r As Row = Tables("窗口_Table1").current
If r("总体积") > 0 Then
    For Each a As Row In Tables("窗口_Table2").Rows
        a("运费") = a("总体积")/r("总体积") * r("运费")
    Next
Else
    For Each a As Row In Tables("窗口_Table2").Rows
        a("运费") = Nothing
    Next
End If

--  作者:woshiabc
--  发布时间:2016/5/11 15:42:00
--  
 谢谢图片点击可在新窗口打开查看