Private Sub Command1_Click()
Dim rs As ADODB.Recordset
Dim rs1 As ADODB.Recordset
Dim stemp As String
Dim stemp1 As String
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
strTemp = "Select * From tbl序列数"
rs.Open strTemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
CurrentDb.Execute "DELETE * FROM 表1" '提前到rs1打开之前对表进行情况
stemp1 = "select * from 表1"
rs1.Open stemp1, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Dim intCount, intCount1 As Integer, intCount2 As Integer
Dim i As Integer
'intCount2 = DCount("SN", "tbl序列数") 就是 rs.recordcount
For i = 1 To rs.RecordCount
rs1.AddNew
rs1!sn = rs!sn
rs1.Update
'rs1.MoveNext
rs.MoveNext 'rs才是要循环的记录集
Next
rs1.Close
Set rs1 = Nothing
intCount1 = DCount("SN", "表1")
MsgBox "已生成: " & Format(intCount1, "#,###") & " 条 新记录!请查看报表!", vbInformation, "生成序列数"
End Sub