Discussion Locked

Backup of access database .....

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Can u please tell is it possible to take a back-up of data contain mdb file with visual basic 6.0.
is it possible please write the code..

5 replies

by sl-campbell

Seeing how an MDB is just a file you could close all connections and then just do a file copy using the "FileCopy" commany.
Or you can compact the database, which compacts it into a new file:

Under DAO:
DBEngine.CompactDatabase "Source.MDB", _ "Destination.mdb

ADO/DAO:
Set a reference to "Microsoft Jet and Replication Objects Library".
Then:
Dim oJDO As New JRO.JetEngine
oJDO.CompactDatabase "Data Source=Orig.Mdb;", _
"Data Source=BackUpName.Mdb;"

Then use "Kill" to delete the original and "FileCopy" to copy the backup as the original name.

This discussion is closed to new replies.