If e.DataCol.Name = "物资名称" Then \'发生变化的是物资名称
Dim dr As DataRow
dr = DataTables("物资明细").Find("物资名称 = \'" & e.DataRow("物资名称") & "\'" ) \'在物资明细表找出该产品
e.DataRow("保存地点") = User.name
If dr IsNot Nothing \'如果找到, 则设置各列内容
e.DataRow("物资类别") = dr("物资类别")
e.DataRow("入库总量") = dr("入库总量")
e.DataRow("原有库存") = dr("库存数量")
e.DataRow("规格") = dr("规格")
e.DataRow("单位") = dr("单位")
If e.DataCol.Name = "入库数量" Then \'如果"入库数量发生变化
e.DataRow ("入库总量") = e.DataRow("入库总量") + e.DataRow("入库数量")
e.DataRow("原有库存") = e.DataRow("原有库存") + e.DataRow("入库数量")
dr("入库总量") = e.DataRow ("入库总量")
End If
Else
e.DataRow("原有库存")= 0
If e.DataCol.Name = "入库数量" Then \'如果"入库数量发生变化
e.DataRow ("入库总量") = e.DataRow("入库数量")
End If
If e.DataCol.Name = "票据号" Then \'如果票据号发生变化,票据号输入完成
Dim nma() As String = {"物资名称","物资编号","物资类别","保存地点","入库总量","品牌","规格","单位"} \'A表数据来源列
Dim nmb() As String = {"物资名称","物资编号","物资类别","保存地点","入库总量","品牌","规格","单位"} \'B表数据接收列
Dim ddd As Row = Tables("物资明细").AddNew
For i As Integer = 0 To nma.Length - 1
ddd(nmb(i)) = e.DataRow(nma(i))
Next
End If
End If
End If
If e.DataCol.Name = "保存地点" Then \'如果保存地点发生变化
Dim mc As DataRow
mc = DataTables("物资管理人").find("部门 = \'" & e.DataRow("保存地点") & "\'")
e.DataRow("保管员") = mc("姓名")
End If
问题在哪呢?