Jump to content

Trying to Automate Database Backup


npersaud

Recommended Posts

I have an access database that I want to set up so that it will automatically make a backup copy of itself every few days (the filename would remain the same except with the date appended to it). I haven't the foggiest idea how to make Access perform this, however. My first two thoughts were to write a VBA script or write a C++ script and have the Access program run it. I still don't know how to make it happen, though!

FYI, this database isn't on a server or anything, really.

Link to comment
Share on other sites


I have an access database that I want to set up so that it will automatically make a backup copy of itself every few days (the filename would remain the same except with the date appended to it). I haven't the foggiest idea how to make Access perform this, however. My first two thoughts were to write a VBA script or write a C++ script and have the Access program run it. I still don't know how to make it happen, though!

FYI, this database isn't on a server or anything, really.

Scheduled task plus a Batch File should do it. :lol:

Here is a sample of a batch file that I use every now and then. :thumbup

@ECHO OFF
:: Year
SET D1=%date:~-4,10%
:: Day
SET D2=%date:~7,-5%
:: Month
SET D3=%date:~4,-8%
SET PATHTODB=c:\DB
SET DBFILE=MyDatabase
SET DBEXT=.mdb
SET PATHTOBACKUP=c:\backup

:: Please note if the path to the backup exists within a network path this will not work
:: you will need to map the network drive first.
COPY "%PATHTODB%\%DBFILE%%DBEXT%" "%PATHTOBACKUP%\%DBFILE%--%D3%-%D2%-%D1%%DBEXT%" /Y

Link to comment
Share on other sites

  • 4 weeks later...
@ECHO OFF
:: Year
SET D1=%date:~-4,10%
:: Day
SET D2=%date:~7,-5%
:: Month
SET D3=%date:~4,-8%
SET PATHTODB=c:\DB
SET DBFILE=MyDatabase
SET DBEXT=.mdb
SET PATHTOBACKUP=c:\backup

:: Please note if the path to the backup exists within a network path this will not work
:: you will need to map the network drive first.
COPY "%PATHTODB%\%DBFILE%%DBEXT%" "%PATHTOBACKUP%\%DBFILE%--%D3%-%D2%-%D1%%DBEXT%" /Y

good,it works fine :thumbup

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...