I am writing a separate Access application that is run from an
icon on the desktop and it simply copies the files to a backup
folder and appends the date and time to the filename. It also has
a restore feature so that the date and time to restore is selected
from a combo. Under test the files appear to copy quite
satisfactorily while open but I am uncertain if there are any
circumstances under which the backup could become corrupted if
database is open. As for restoring back over a database that is
open, I have not even attempted. I guess that I just want to feel
comfortable there there is a high probability of always having
good backups and good restores.
You are treading on dangerous ground. A hot backup copy made via the
file system is never going to be 100% reliable. You need to use Jet
functionality to do the backup, since Jet will respect locks on the
data and create a backup file that has consistent and valid data in
it (though it may not have a few uncommitted data changes -- at most
it could be a few minutes out of date). There are two methods to
accomplish this:
1. copy all the tables to a new MDB via TransferDatabase. This
always seems too fussy to me.
2. open the back end and use:
Application.SaveAsText 6, vbNullString, [path/filename of new MDB]
I have never found a method for running this command except on the
currently opened MDB.
To restore the back end, you have to kick everybody out of the
database. The usual method for doing this is to have a timer form in
the front end that monitors a table in the back end. When a record
is added to that table indicating the users have to shut down, the
timer detects it and notifies the user to log out. If the user
doesn't log out in a suitable time frame, you walk through the forms
collection and save any dirty records and then close the app.
But I'd hesitate to do this, because what if new data has been added
in the current sessions? Are you just going to overwrite it with the
backup file?
I think you have major conceptual problems with the task you seem to
be wanting to accomplish.