需求:将外部数据表MS_Client的记录逐行都写入“客户资料”表,弹出来“索引超出了数组界限”提示,且“客户资料”表只新增第一行第一列的数据
此主题相关图片如下:未命名11.png

Dim Result As DialogResult
Result = MessageBox.Show("对接资料会覆盖原有数据,确定要对接客户资料吗?","提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
If Tables("MS_Client").Rows IsNot Nothing Then
Tables("客户资料").stopredraw
Dim nma() As String = {"client_no","name","sala_addre","rea_man","rea_tel"} 'A表数据来源列
Dim nmb() As String = {"客户编号","公司名称","地址","联系人","联系方式"} 'B表数据接收列
For n As Integer = 1 To Tables("MS_Client").Rows.count - 1
Dim r As Row = Tables("客户资料").addnew()
r(nmb(n)) = Tables("MS_Client").current(nma(n))
Next
Tables("客户资料").ResumeRedraw()
End If
End If
[此贴子已经被作者于2018/3/2 10:40:24编辑过]