Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run .bat from within Access 1

Status
Not open for further replies.

infinitx

Technical User
Feb 26, 2004
212
US
Hi,

This is probably a very simple question that I haven't found an answer to...

I have a backup.bat file that backs up the back-end of the Access program. I want the user to click a button that runs the backup.bat that backs up the back-end of the program.

How is this done?

Another problem I have is that it won't back up if the program is open.

Is there a code that is placed in a Command's OnClick Event that does the following:

-Close the Access Program
-Runs backup.bat
-Re-opens Access Program?

Thanks,
Alex


 
Alex,

It is not possible for Access to trigger code to run after the database has closed for what should be fairly obvious reasons.

You can sometimes get away with using the shell command to copy an open file, but remember that the backup will only be as up to date as the backup is made.

John
 
Thanks for responding John,

How would I go about creating a shell command to copy an open file?

Thanks,
Alex
 
Just another thought,

Could I do this from an external program such as create a Visual Basic Application that would do this for me?

Here's what I am picturing and correct me if I'm wrong:

From the Access Switchboard, the user clicks "Back Up Database." Access closes and a VB App loads. On the form's OnLoad Command, have a code that executes the backup.bat and then re-opens the database.

Could it be done this way? If so, how?

Thanks,
Alex
 
Alex

Shell (Environ$ ("COMSPEC") & " /C ""C:\My Documents\File1.mdb"" ""C:\My Documents\File2.mdb""")

will copy C:\My Documents\File1.mdb to C:\My Documents\File2.mdb.

Re your second suggestion, you could do it with an external program in VB6 (or any other language). However, this is an Access forum, and to discuss its use would be outside the scope of this forum and as such off topic.
I would suggest asking within the appropriate forum here related to the programming language that you would consider writing this in.

John


 
Thanks John,

I'll give that a thought!

Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top