I saw your post from about a month ago, and just a few weeks ago I had to figure this out. This is what I came up with, it works really well. I've basically got a backend this is getting copied to that has a lot of concurrent users all the time, and there's around 4000 records daily that need to get imported into this table. An append is NOT an option, as it pretty much dies because of the concurrent users. It takes about 60 seconds or less with this code to get everything in there.
I've got a control on a form that this is referencing for the loop condition, that updates the count of records that have been copied (I use a count on the backup table for this) and how many are left (I use a temp table, because as you can see I'm selecting the top 250 records for the copy, and then deleting them afterwards, then looping through until they are all gone.)
I'm using queries instead of opening the tables themselves because it's much, much faster.
Tables and Queries used:
tblCopyFrom: Has an autonumber field that I can use to select TOP 250 from, in addition to the normal datafields
tblPastingTo: This is the destination table
tblPastedBackup: This is a backup table of what was copied
qryCopyFrom: "SELECT TOP 250 tblCopyFrom.RecNum, * FROM 250 tblCopyFrom;"
qryPastingTo: "SELECT * FROM tblPastingTo WHERE somefield is null;" --I choose a field that is never null, so that the query returns no rows. This way it pops up very quickly, and allows me to pastappend quickly
qryPastedBackup: "SELECT * FROM tblPastedBackup WHERE somefield is null;"
CODE
'''JNankivel 2005
'''Open query on table to copy from
DoCmd.OpenQuery "qryCopyFrom", acViewNormal, acEdit
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdCopy
'''Open query on table to paste to
DoCmd.OpenQuery "qryPastingTo", acViewNormal, acEdit
DoCmd.RunCommand acCmdPasteAppend
'''Open query on a backup table to copy to (keeps a record of what you copied each day as a backup)
DoCmd.OpenQuery "qryPastedBackup", acViewNormal, acEdit
DoCmd.RunCommand acCmdPasteAppend
DoCmd.Close acQuery, "qryPastingTo", acSaveNo
DoCmd.RunSQL ("DELETE qry_selTop250tblToPaste.* FROM qry_selTop250tblToPaste;")
Do While Me.txtCount > 0
DoCmd.OpenQuery "qryCopyFrom", acViewNormal, acEdit
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdCopy
DoCmd.SelectObject acQuery, "qryPastingTo", False
DoCmd.RunCommand acCmdPasteAppend
DoCmd.SelectObject acQuery, "qryPastedBackup", False
DoCmd.RunCommand acCmdPasteAppend
DoCmd.Close acQuery, "qryCopyFrom", acSaveNo
DoCmd.RunSQL ("DELETE qry_selTop250tblToPaste.* FROM qry_selTop250tblToPaste;")
Loop
DoCmd.Close acQuery, "qryCopyFrom"
DoCmd.Close acQuery, "qryPastingTo"