Link to home
Start Free TrialLog in
Avatar of Jessee
JesseeFlag for Australia

asked on

VB6 Access Copy database

Hey,

Im adding a backup feature to my program, and am needing to copy my database to a specified location.
Problem is im unable to close the database so im needing to know how to re-create the database at the specified location.

Any ideas?

Thanks!
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

https://www.experts-exchange.com/questions/21364411/Backup-for-Access-database-using-VB6.html?sfQueryTermInfo=1+10+30+access+backup+dhaest

Easiest way to backup a access-database: Just copy the file to another location
(in vb:    
dim strFileNameOriginal as string
dim strFileNameBackup as string
strFileNameOriginal = "c:\YourPath\YourDatabase.mdb"
strFileNameBackup = "c:\Backup\YourDatabase.mdb"

FileCopy strFileNameOriginal, strFileNameBackup

Otherwise, you can take a look at:
With the help of this tool you can take backup of your MS-Access files and also restore the files.
With Auto backup facility and more. Try it.
http://www.a1vbcode.com/download.asp?ID=3252
Also remember that it is NEVER a good idea to copy an in-use Access file (or any other file for that matter). In most cases it won't matter, but if you happen to copy that file at the same time as someone attempts to write to the database, you'll end up with a corrupt file - and the only thing worse than no backup is a corrupt backup :)

ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jessee

ASKER

Hey,

Yeah I have use FileCopy before but it didnt work out as if the Database was open which in most cases it is, I would get a permission denied error.

Will give these methods a go now.