以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  引用异常代码求改  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=92640)

--  作者:yaojun
--  发布时间:2016/11/9 11:11:00
--  引用异常代码求改

物料计划表,需要引用采购明细表里面的供货单位:

If e.DataCol.Name = "识别号" Then
    Dim nms() As String = {"供货单位"}
    If e.NewValue Is Nothing Then
        For Each nm As String In nms
            e.DataRow(nm) = Nothing
        Next
    Else
        Dim dr As DataRow
        dr = DataTables("采购明细").Find("[识别号] = \'" & e.NewValue & "\'")
        If dr IsNot Nothing
            For Each nm As String In nms
                e.DataRow(nm) = dr(nm)
            Next
        End If
    End If
End If

 

采购明细表,需要引用物料计划表的订单号,交期:

If e.DataCol.Name = "识别号" Then
    Dim nms() As String = {"订单号","交期"}
    If e.NewValue Is Nothing Then
        For Each nm As String In nms
            e.DataRow(nm) = Nothing
        Next
    Else
        Dim dr As DataRow
        dr = DataTables("物料计划").Find("[识别号] = \'" & e.NewValue & "\'")
        If dr IsNot Nothing
            For Each nm As String In nms
                e.DataRow(nm) = dr(nm)
            Next
        End If
    End If
End If

以上二段代码,第二段可以实现,第一段不能实现,求救


--  作者:有点蓝
--  发布时间:2016/11/9 11:44:00
--  
不知道你的数据流转是怎么样的

试试
dr = DataTables("采购明细").Find("[识别号] = \'" & e.OldValue & "\'")

--  作者:yaojun
--  发布时间:2016/11/9 12:03:00
--  

不行,我再理下思路吧,看能不能不这么做