For Each pr As DataRow In DataTables("存货账").DataRows Dim s As String For Each cr As DataRow In pr.GetChildRows("存货档案") Dim nr As DataRow = cr.GetParentRow("采购付款表") If nr IsNot Nothing pr("系统自动编号") = nr("系统自动编号") pr("单据号码") = nr("进仓单号") Exit For End If Next Next