No of visitors who read this post: 1112
Category: Visual basic
Type: Question
Author: Joanne Cruz
No votes yet

I want to add backup and restore function in my VB6.0 project. I want the program to create a backup folder containing the backup file of my access database in drive C: of my computer upon clicking the backup button.

I also want to add restore function so that if I accidentally deleted the to my backup folder, I can restore it.

Please let me have the simplest code for this. Thanks.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

# Comment Id: 57708

All you need is backing up and restore of a database records. There are various ways by which you attain it.
1. Copy the access file to another directory.
2. For each record of a database, Copy it to same other format (encrypting) to some other file.
The first solution which is achieved using the File_Copy method found inbuilt in libraries of VB 6.0.
The next solution is achieved by connecting to the database and then if you are using ADODC, then
adodc1.recordset.movefirst
while adodc1.EOF=false
 <write to a file the entire record>
 adodc1.recordset.movenext
Wend
When you retrieve the file then first solution is copy the file back to the path.
Next Solution replace/append all entries of the file into each record of the database using adodc1.recordset.addnew
<copy the file data to the record attributes>
adodc1.save
Continue this for the whole file.