楼主您看看:
http://www.foxtable.com/help/topics/2044.htm
要加上判断,因为不一定总是有符合条件的行:
Dim nma() As String = {"产品成本价","订单编号","供应商名称","产品名称","产品数量","产品piao面价","产品批号","仓库名称","入出库类型"} 'A表数据来源列
Dim nmb() As String = {"产品入仓成本价","订单编号","供应商名称","产品名称","产品数量","产品入仓piao面价","产品批号","仓库名称","入出库存类型"} 'B表数据接收列
Dim tr As DataRow
With DataTables("库存明细表")
tr = .Find("订单编号 = '"& tables("订单明细表").Current("订单编号")&"'") '找出最后一次订购PD01产品的记录
End With
If tr IsNot Nothing Then
If tr("订单编号")="" Then
For Each r As Row In Tables("订单主表.订单明细表").Rows
Dim dr As DataRow = DataTables("库存明细表").AddNew
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = r(nma(i))
Next
Next
End If
End If
另外建议卡看这个
http://www.foxtable.com/help/topics/1485.htm
这样遇到问题,可以快速找出出错的代码
[此贴子已经被作者于2013-12-11 17:43:39编辑过]