以文本方式查看主题

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

--  作者:foxuser
--  发布时间:2018/7/30 20:01:00
--  引用数据
有表A,列名投料卷号,厚度,宽度,表B,列名投料卷号,投料厚度,投料宽度,想实现在表B录入投料卷号时,引用表A的厚度,宽度
--  作者:有点蓝
--  发布时间:2018/7/30 20:33:00
--  
参考:http://www.foxtable.com/webhelp/scr/1451.htm

表B,datacolchanged事件

If e.DataCol.Name = "投料卷号" Then
    If e.NewValue Is Nothing Then
        e.DataRow("投料厚度") = Nothing
        e.DataRow("投料宽度") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("表A").Find("[投料卷号] = \'" & e.NewValue & "\'")
        If dr IsNot Nothing Then 
            e.DataRow("投料厚度") = dr("厚度")
            e.DataRow("投料宽度") = dr("宽度")
        End If
    End If
End If