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!

Backing Up Database Automatically 1

Status
Not open for further replies.

infinitx

Technical User
Feb 26, 2004
212
US
Hi,

On the main switchboard I have a command button "Back Up Database" that has the following OnClick code:

Code:
Macro2

Code for Macro2
Code:
RunApp C:/backup.bat

Backup.bat was created in Notepad and has the following text:

copy Database.mdb C:\Backup /y

When the user clicks "Back Up Database" I want the database to close, execute backup.bat, and reopen.

Is this possible?

Thanks,
Alex

 
Hi,

Why not place an MS Access icon on your batch file within the folder that runs your application? This makes it look like an MS Access application.

It makes no sense to run your app - to close it down and then re-open it. It'll take 100 times longer anyway.

Within your back-up batch-file, you could add a line that kicks your application off AFTER it's been backed up.

I understand your thinking of controlling all from within your application, but this really makes no sense in this case.

Is this application not run from a server anyway? If not - why not? If it is, is the server not backed-up?

Regards,

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience. darrylles@yahoo.co.uk
 
Thanks for responding,

This application is not run on a server as it is going to be distributed to multiple people.

I thought that it would be easier for the user to click "Back Up Database" from the actual program so they don't have to click on the actual .bat file.

When I use Macro2 as the OnClick event, it runs backup.bat, but it doesn't actually back up the program. Why?

While the program was still running, I clicked on the backup.bat file manually and it backed it up! Why does it work this way and not through the Macro?

Thanks!
 
Hi!

Copying open files from "whithin" itself, might provide some challenges.

The method posted by Quehay here thread181-767477, seems to do a rather good job from within the application (look at the last routine posted - there's also a rather good errorhandling routine there too)

Roy-Vidar

Roy-Vidar
 
Thanks for responding Roy,

Actually, I haven't said this before, but I am actually backing up the back-end portion of the access program (which contains all of the user data).

I have just found out that while the program is loaded (i've only tried this when only the switchboard is loaded), the back-end portion of the program is actually not being used!

So my question now is, how do I copy the back-end file (C:\database_be.mdb) to C:\Backup directory?

Thanks again,
Alex
 
You didn't try?

Quehays code, if there is a backend, takes a backup of the backend. If no backend, backups current db.

Roy-Vidar
 
Roy,

I did look over the code but it was overwhelming! I'll try and give it another look but....

I just thought that there might be a simpler way to do this such as using .bat files.

Alex
 
Hi Roy,

I figured out how to substitute my information in the code and it worked!

Thanks for the reference,
Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top