Hi all,
I've inherited a setup that utilizes Access 97 databases. I need to copy a table from one main mdb to multiple others to prep them for use. The source mdb and source table are mostly static, the destination mdbs vary widely.
So, I have:
source.mdb contains table A
destination.mdb contains tables 1, 2, and 3
I need to end up with:
source.mdb is unchanged (contains table A)
destination.mdb contains tables 1, 2, 3, and A
This is a simple enough task within the Access GUI, but because this task needs to happen hundreds of times in a day, I'd like to automate it. The ultimate goal is to have a script or batchfile that I can give each mdb user (about 75 employees) to manipulate each database on their own before use. I'm much more at home in a UNIX/Oracle environment, so scripting this up has thrown me for a loop.
In Oracle, I would use a query like this:
copy from user/password@sourceDB to user/password@destinationDB
create new_tableA using select * from tableA;
A similar question here on stack overflow tells how to copy records from one table to another, but the destination table pre-exists, and particular fields are defined:
strSQL = "INSERT INTO ServiceRecordInvoices " & _
"( sriID, sriServiceRecordID, sriInvoiceDate, sriInvoiceNumber, " & _
"sriDescription, sriInvoiceAmount ) " & _
" IN '" & strDatabasePathandNameTo & "' " & _
"SELECT srpID, srpServiceRecordID, srpInvoiceDate, srpInvoiceNumber, " & _
"srpParts, srpPartsAmount " & _
"FROM ServiceRecordParts IN '" & strDatabasePathandNameFrom & "';"
My first try looks like this and unsurprisingly, doesn't work. Can someone steer me right?
copyTableSql = "CREATE [new_tableA] " & _
" IN '" & destinationDBpath & "' " & _
"SELECT * FROM tableA IN '" & sourceDBpath & "';"
Thanks for any advice.