Backup Solution Access 2000/XP/2003 MDB file with source code. A sample code shows how you can automate daily backup of data file. First it checks if backup was already done today (using custom property on database), if no – then it make a copy of data file to specified to default folder, and finally it compacts a data file. In multi-user environment backup runs once per day when first user starts application.
To run a sample code: Open BackupSolution.mdb in Access. Run Linked Tables Manager to relink tblClient to DataFile.mdb. Run mcBackup macro to perform a backup. Sample database will create a new folder Backup and make a DataFile.mdb file there.
To implement this solution into your database you can copy mdlBackUpSolution into your database, and then modify a autoexec macro (or VBA procedure which runs first when you start database) – directly after procedure where you check if linked tables are linked – you add a line like in provided mcBackup macro or VBA code:
If ToBackup() then BackUpNow() End if
You can also implement a custom options dialog where user can set backup options.
Download: BackupSolution.zip (32 kb)
|