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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying .mdb files for backup purposes

Status
Not open for further replies.

Jackie

MIS
Feb 9, 2000
148
US

Is there a command for copying access .mdb files?

I have a requirement to backup the application and backend .mdb's to another drive.

The Access documentation refers to Backup/Recovery as using Windows Explorer to copy and paste the .mdb files to another directory.

My client wants to do Backup/Recovery from within the application.

Thank you in advance for your help.

-jackie
 
What I do is make a DOS-style batch file to copy all my files to a new directory which has the current date and time. It runs every time my computer boots up (and whenever else I decide I need to backup):
Code:
Rem Backup.bat
echo off
for /f "tokens=1-4 delims=/ " %%a in ('date /t') do (set weekday=%%a& set month=%%b& set day=%%c& set year=%%d)
for /f "tokens=1-2 delims=/: " %%a in ('time /t') do (set hour=%%a& set minute=%%b)
c:\progra~1\micros~2\office\msaccess k:\requests_fe.mdb /compact
c:\progra~1\micros~2\office\msaccess k:\requests.mdb /compact
c:\progra~1\micros~2\office\msaccess k:\requests_noncitrix_fe.mdb /compact
mkdir g:\access\backup\backup-%year%-%month%-%day%-%hour%-%minute%-%1
copy k:\ICG_Request\Requests\*.* g:\access\backup\backup-%year%-%month%-%day%-%hour%-%minute%-%1

The brilliant code for setting the year/month/day/time into environment variables I found on a DOS batch file web site.

The directory is in the format YYYY-MM-DD--HH-MM(A/P), so for example: 2003-03-31-8-59a
This way it sorts chronologically properly.


Put your equivalent batch file wherever you store the database. I don't recommend attempting to copy the database file while the database itself is open. Trust me on this--this is not an option you want. Data corruption (of the backup) may occur. But, if you HAVE to, you can run the batch file using the Shell("exact path and filename of batch file") command. --
Find common answers using Google Groups:

 
Just to be clear, this batch file is part up your Startup process.

How does this batch file get run "manually" by the user?

I'm thinking of the user must manually execute the batch file he/she could just as easily use Explorer to copy/paste.

Thanks again for your help.

-jackie
 
1. Manually run: yes, it could be just as easy to copy the file using Explorer, but this method is more precise. It also logs the exact date/time of the copy. You can make a shortcut that links to the batch file and put the shortcut on the desktop. The user could run this shortcut like any other program.

2. Don't get confused with the startup talk. I was using myself and my methods as an example--use whatever is appropriate in your case. For traditional backups, people use the MS Task Scheduler to run backups late night every night. --
Find common answers using Google Groups:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top