vb recordset copy table

I have two databases and would like to copy one table into another in the other database.

I can read all the information into a recordset.

I am looking for an easy way to put the old data into the new table without having to loop and specify the insert statement.

I am trying to copy table results into results_old in the new db.
Who is Participating?
ArkConnect With a Mentor Commented:
Opps, sorry, should be

conn.Execute "SELECT INTO results_old FROM results IN ""C:\OldDatabase.mdb""", , adExecuteNoRecords
Use a make table query

SELECT INTO results_old FROM results
jackjohnson44Author Commented:
this is across 2 databases, how can you do that with one statment and one connection?
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Hi, you can link from one database to another. The way to to this depends on the type of database. I could give you examples for SQL Server and Access databases. Once the link is made, you could use cquinn's comment to transfer the data.

However, if this is something you'd only like to do once, you might be better off using the SQL Server Data Transformation Services (DTS). This is an easy tool that enables you to copy data and tables from one datasource to another data source. DTS doesn't care wether it's an Access, MySQL, SQL Server, Excel, Oracle or ASCII data source. If it's two MS Access tables, you could just open both databases in different instances of MS Access, and simply copy/paste the table.

Good luck.

cquinnConnect With a Mentor Commented:
From within the target database run this query

SELECT INTO results_old FROM results IN "C:\OldDatabase.mdb"
jackjohnson44Author Commented:
I would like to use visual basic.

I currently have a program that gets data from one database loops throught the recodset and I use insert statements to put it in the other database.  I don't want to have to specify the column names and do an insert statement.  Can someone help me accomplish this?

If your solution does not include vb, please do not respond, it is not what I am looking for.

cquinn already answered your question. VB code:
conn.Execute SELECT INTO results_old FROM results IN "C:\OldDatabase.mdb", , adExecuteNoRecords

where conn is your connection to new database
Ark and cquinn are right. By using the IN-statement, you don't even need to specify a link first. I think that's the easiest approach.

Good luck
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.