Dim con As Object
Dim rst As Recordset
Dim strsql As String
Set con = Application.CurrentProject.Connection
strsql = "SELECT * FROM [表1]"
Set rst = New ADODB.Recordset
rst.Open strsql, con, 1
Dim con1 As Object
Dim rst1 As Recordset
Dim strsql1 As String
Set con1 = Application.CurrentProject.Connection
strsql1 = "SELECT * FROM [表2]"
Set rst1 = New ADODB.Recordset
rst1.Open strsql1, con1, adOpenKeyset, adLockOptimistic
If (rst.EOF) Then
MsgBox "表1没有数据"
Else
While (Not (rst.EOF))
For i = 1 To rst("数量")
rst1.AddNew
rst1("型号") = rst("型号")
rst1("规格") = rst("规格")
rst1.Update
rst1.MoveNext
Next i