Copy a database automatically when the databse closes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Currently I have a database(1) that is linked to another database(2). When I
close database(1) from a form with Close Icon I need to make a copy of
database(2) to a different location.

Is this possible to write code into a macro or into VB to do this?

Thanks!!!!
 
Hi,

Why not wrap the whole thing in a batch file e.g.

---- Start of batch file ----
start c:\myaccessdb.mdb /wait
xcopy c:\myaccessdb.mdb \\myserver\backup\*,* /y
xcopy c:\myaccessdb.mdb \\myserver\backup2\*.* /y

---- end of batch file ----

the start command on line one should wait for the db to close before
executing the last 2 lines. The reason I have opted for this way is I don't
like copying anything that is already open.

Hope it helps.
 
I create a batch file which I hadn't thought of using that approach.

It did copy the file but while it was open and before any changes could be
made.

Yeah, I was hoping to have it copy after it closes. Is it possible to run
it after it closes?
 
Yes, the 'trick' is execute the access program via the batch file using the
'start' command with /wait and the line after is the copy, give it a go any
problems post back here.
 
Back
Top