In Access I would like before I start a procedure to make a back up of my database

cres1121
cres1121 used Ask the Experts™
on
I would like to create a macro to make a copy of my split data database when I click on a button.    I would like to make a back up before we do payroll bi monthly.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Dale FyeOwner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010

Commented:
as long as there are no other users logged into the database, you could use the CompactDatabase method.  The syntax is:

dbengine.CompactDatabase SourceName, DestinationName

but first you need to make sure that no one is logged into the Source database.
Dale FyeOwner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010

Commented:
I'm sure you could also use the Filecopy command, again assuming that the backend is not already open.
MIS Liason
Most Valuable Expert 2012
Commented:
Or you could run a batch file before you run the payroll

Create a text file named
DB_BU.bat

Edit the file to be something like this:
    Copy C:\YourFolder\YourDatabaseBackEnd.accdb C:\Backups\YourDatabaseBackEndBU.accdb

Then make a shortcut to this batch file, and drop it on the desktop.
(The Location/Target will be the exact drive, location, filename and extension of the batch file
for example:
    C:\YourBatchFiles\DB_BU.bat

Now you can run double-click the shortcut to do your backup.
(Verify the backup, after you run the shortcut)


JeffCoachman

Author

Commented:
Thanks I will try these.  I did not know anyone had posted.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial