'在工程---部件中添加 microsoft ADO data contcrol 6.0
'在窗体添加两个adodc控件,分别连接好数据库和所需导入导出的表
'adodc1连接要导入的表,adodc2连接要导出的表
Private Sub Command1_Click()
Dim i, j As Integer
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc2.Recordset.MoveFirst
For j = 1 To Adodc2.Recordset.RecordCount
Adodc1.Recordset.AddNew '添加一条空记录
For i = 0 To Adodc2.Recordset.Fields.Count - 1
Adodc1.Recordset.Fields(i).Value = Adodc2.Recordset.Fields(i).Value
Next i
Adodc2.Recordset.MoveNext
Next j
Adodc1.Recordset.Update
Else
MsgBox "表2没有数据可入导表2"
End If
End Sub