|
Sub AtoB(ByVal Atbname As String, ByVal m As Integer, ByVal Btbname As String)
Dim rsA As New ADODB.Recordset, rsB As New ADODB.Recordset
Dim i As Long, j As Long
Dim vals(m - 1) As Variant
rsA.Open Atbname, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rsB.Open Atbname, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
For i = 1 To rsA.RecordCount
vals((i - 1) Mod m) = rsA.Fields(0).Value
If i Mod m = 0 Then
rsB.AddNew
For j = 0 To rsB.Fields.Count - 1
rsB.Fields(j).Value = vals(j)
Next
rsB.Update
End If
rsA.MoveNext
Next
End Sub |
|