You can run Insert queries referencing external Access database files files (MDB, ACCDB, etc). For example:
strSQL = "INSERT INTO ServiceRecordInvoices " & _
"( sriID, sriServiceRecordID, sriInvoiceDate, sriInvoiceNumber, " & _
"sriDescription, sriInvoiceAmount ) " & _
" IN '" & strDatabasePathandNameTo & "' " & _
"SELECT srpID, srpServiceRecordID, srpInvoiceDate, srpInvoiceNumber, " & _
"srpParts, srpPartsAmount " & _
"FROM ServiceRecordParts IN '" & strDatabasePathandNameFrom & "';"
Note the two string variables strDatabasePathandNameTo
and strDatabasePathandNameFrom
. The above dynamic SQL code will work fine in either DAO or ADO.
If the two tables are identical then you could use the following (untested):
strSQL = "INSERT INTO ServiceRecordInvoices.* " & _
" IN '" & strDatabasePathandNameTo & "' " & _
"SELECT * " & _
"FROM ServiceRecordParts IN '" & strDatabasePathandNameFrom & "';"