以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  跨表引用  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=131040)

--  作者:DLW77
--  发布时间:2019/2/14 19:08:00
--  跨表引用
老师,你好,我想跨表引用另一个表的数据,但是引用最后一下数据,我这个代码重置了没反映,是哪里错了?
我是从“进退货历史”表中,引用最后或最近日期进货的同品号的单价。
If e.DataCol.Name = "子件品号" Then 
    If e.NewValue Is Nothing Then 
        e.DataRow("最新单价") = Nothing 
    Else
        Dim dr As DataRow
                dr = DataTables("进退货历史").Find("[品号] = \'" & e.NewValue & "\'AND_Identify desc")
        If dr IsNot Nothing Then
            e.DataRow("最新单价") = dr("单价") 
        End If
    End If
End If

--  作者:有点甜
--  发布时间:2019/2/14 19:13:00
--  


If e.DataCol.Name = "子件品号" Then
    If e.NewValue Is Nothing Then
        e.DataRow("最新单价") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("进退货历史").Find("[品号] = \'" & e.DataRow("子件品号") & "\'", "_Identify desc")
        If dr IsNot Nothing Then
            e.DataRow("最新单价") = dr("单价")
        Else
            msgbox(123)
        End If
    End If
End If

 


--  作者:DLW77
--  发布时间:2019/2/15 15:27:00
--  可以了,谢谢老师
可以了,谢谢老师