Insert into Another Database

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
 
J

John Mishefske

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"
 
P

Paul Ilacqua

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
 
J

John Mishefske

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top