不就是查两个表而已?修改代码
If e.DataCol.Name = "毛坯编码" Then
Dim nms() As String = {"生产批次","批次序号","成品编码","成品描述"}
If e.NewValue = 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
ElseIf e.DataCol.name = "成品编码" Then
Dim nms() As String = {"工序号"}
Dim nms1() As String = {"加工工序"}
If e.NewValue = 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 i As Integer = 0 To nms.length-1
e.DataRow(nms(i)) = dr(nms1(i))
Next
End If
End If
End If