Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how can I copy an ADO database to a new database?

Posted on 2001-06-20
4
Medium Priority
?
125 Views
Last Modified: 2010-05-02
I want to connect to a database with the ADO data control, remove or edit a bunch of records and then save it to a different place. Is this possible? I haven't found anything in the help file or in the books I've been reading.
0
Comment
Question by:chaos_59
4 Comments
 
LVL 6

Accepted Solution

by:
sharmon earned 800 total points
ID: 6212594
Is this a file based database like Access?  If so, why don't you just copy the database file via code to this different place first, then connect to the copied database via ADO and do your updates on the copied database directly.
0
 
LVL 2

Expert Comment

by:TravisHall
ID: 6212714
What he said. (Which is to say, Sharmon deserves the points, not me.)

But also, generally you don't save a database. The database provider writes any changes you make automatically. Once you change the database, for all intents and purposes, it is changed. There is no original that you can revert to later after saving to a different file.

So with databases, copy then change, or extract then transform and import. Never change then save.
0
 
LVL 5

Expert Comment

by:gbaren
ID: 6216678
chaos,

You can use a disconnected recordset.

1. Connect to source
   rs.ActiveConnection.Open "DSN1"
2. Get a Recordset
3. Disconnect
   rs.ActiveConnection.Close
4. Update the Records
5. Connect to a different source
   rs.ActiveConnection.Open "DSN2"
6. Update
   rs.UpdateBatch

I don't know whether this would work. It does sound reasonable, though.

gbaren
0
 
LVL 1

Author Comment

by:chaos_59
ID: 6271537
This was the conclusion I was trying to avoid, but it seems like the only/best answer.
Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question