哦,iif会把所有的代码都执行一次的。
Dim Cols1() As String = {"存货编码","存货中文名","规格型号","品牌","主计量单位"}
Dim Cols2() As String = {"存货编码","存货中文名","规格型号","品牌","主计量单位"}
Dim count As Integer = 0
For Each r1 As Row In Tables("存货选择_table1").GetCheckedRows
Dim t As Table = Tables(vars("表名"))
Dim r2 As Row
If count = 0 Then
r2 = t.current
Else
r2 = t.addnew
End If
count += 1
For i As Integer = 0 To Cols1.Length -1
r2(Cols2(i)) = r1(Cols1(i))
Next
Next
Forms("存货选择").close