I'm opening a second database (db2).
Copying the structure of a db2 table to db3.
Populating the table in db3 with a subset of records from db2.
I've gotten as far as opening the db2 and copying the table structure. Can't figure out how to run the query using execute rather than docmd.openquery.
Any helpful hits appreciated.
Copying the structure of a db2 table to db3.
Populating the table in db3 with a subset of records from db2.
I've gotten as far as opening the db2 and copying the table structure. Can't figure out how to run the query using execute rather than docmd.openquery.
Code:
Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess .OpenCurrentDatabase "DbPathString"
'copy the table structure to dbQn, overwrites any previous with same name
appAccess.DoCmd.TransferDatabase acExport, "Microsoft Access", DestinationDb.Name, acTable, SourceTableName, DestinationTableName, True
'populate the table in db3
strSql = "INSERT INTO ......."
" IN '" FullDbPathString "'[MS ACCESS;];"
'how to execute SQL?
??.Execute strSql
appAccess.CloseCurrentDatabase
appAccess.Quit
Set appAccess = Nothing
Any helpful hits appreciated.