Dim cando As Boolean = True
Dim rs As List(of Row) = Tables("表A").GetCheckedRows
Dim bh As String = re(0)("单位代码")
For Each r As Row In rs
If r.IsNull("物料编号") OrElse bh <> r("单位代码") Then
cando = False
Exit For
End If
Next
If cando Then
Dim dr As Row
For Each r As Row In rs
dr = Tables("表B").AddNew
dr("物料编号") = r("物料编号")
......其它列
Next
End If