Insert into Another Database

  • Thread starter Thread starter Paul Ilacqua
  • Start date Start date
P

Paul Ilacqua

How do I Insert the results of a query into a table in another database? I
do not want to use Transfer Database I want to use an SQL Statement and do a
DB.Execute in VBA Code

Thanks
Paul
 
Paul said:
How do I Insert the results of a query into a table in another database? I
do not want to use Transfer Database I want to use an SQL Statement and do a
DB.Execute in VBA Code

You can do it in a query:

SELECT
*
INTO
theOtherTable IN 'c:\temp\other.mdb'
FROM
yourQuery

or run that statement in code with

CurrentDb.Execute "SELECT * INTO theOtherTable IN 'c:\temp\other.mdb'" & _
" FROM yourQuery"
 
John,
I settled on a "INSERT INTO" variation of your query and did a drop and
recreate table using DAO's DDL. I needed several indexes on the new table
and it will be between 3 - 5 k rows each night. The drop - create "INSERT
INTO" variation of your query into an empty table runs very fast. I then
appy the new indexes Thanks for the quick response.
Paul
 
Paul said:
John,
I settled on a "INSERT INTO" variation of your query and did a drop and
recreate table using DAO's DDL. I needed several indexes on the new table
and it will be between 3 - 5 k rows each night. The drop - create "INSERT
INTO" variation of your query into an empty table runs very fast. I then
appy the new indexes Thanks for the quick response.
Paul

Yes, that was a better solution. Good luck on your project.
 
Back
Top