以文本方式查看主题

-  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=184442)

--  作者:mengxxaa
--  发布时间:2022/12/7 16:16:00
--  [求助]跨表引用不成功,什么原因呢
代码如下:
If e.DataCol.Name = "dnd_cust" Then
    If e.NewValue Is Nothing Then
        e.DataRow("dnd_add") = Nothing
        e.DataRow("dnd_conta") = Nothing
        e.DataRow("dnd_phone") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("cm_mstr").Find("[cm_cust] = \'" & e.NewValue & "\'")
        If dr IsNot Nothing Then
            e.DataRow("dnd_add") = dr("cm_add")
            e.DataRow("dnd_conta") = dr("cm_conta")
             e.DataRow("dnd_phone") = dr("cm_phone")
        End If
    End If
End If

填入dnd_det表中的dnd_cust,将cm_mstr表中的cm_add,cm_conta,cm_phone调用到dnd_det表中的dnd_add,dnd_conta,dnd_phone列。(dnd_cust与cm_cust为同一值)。
图片点击可在新窗口打开查看此主题相关图片如下:提示.png
图片点击可在新窗口打开查看

--  作者:有点蓝
--  发布时间:2022/12/7 16:17:00
--  
dr = DataTables("cm_mstr").Find("cm_cust = \'" & e.NewValue & "\'")