Copy a database automatically when the databse closes

J

JeffH13

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!!!!
 
A

Alex White MCDBA MCSE

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.
 
J

JeffH13

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?
 
A

Alex White MCDBA MCSE

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top