Solved

Writing to second database

Posted on 2000-03-15
2
191 Views
Last Modified: 2010-04-02
I have an application using Dao with an Access database. I want to allow the user to "archive" old records to a separate database and view them from the "archive" file later.
The archive file needs to be user-nameable for creation when sending the current records to the archive.
I have an empty database file (named "archive.mdb") which I can copy to a new file based on the user's input. That part is working fine. The problem comes in creating CDaoRecordset- derived objects connected to that new database file.
Not looking for code here, just the framework of the approach -- how to create and connect recordsets to a user-nameable database file, etc.
0
Comment
Question by:sonora
2 Comments
 
LVL 4

Accepted Solution

by:
abancroft earned 75 total points
ID: 2620798
I'm not sure if this is what you're looking for, but to connect to a named MDB file, create a CDaoDatabase object & call the Open() method.

e.g.
CDaoDatabase dbArchive;

dbArchive.Open("C:\\TEMP\\ARCHIVE.MDB");

CDaoRecordset rsArchive(&dbArchive);
0
 
LVL 1

Expert Comment

by:Dhrubajyoti
ID: 2622280
I think you want to use a different
database.You may declare a new database
object of type CDatabase or CDaoDatabase
Open your  database using your new Accees file.
 Open record set using the second database object and write your data into the table using the recordset opened using the second database.
 
     



         
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

930 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now