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

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.
cres1121Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Dev-Soln LLCCommented:
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 LLCCommented:
I'm sure you could also use the Filecopy command, again assuming that the backend is not already open.
Jeffrey CoachmanMIS LiasonCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cres1121Author Commented:
Thanks I will try these.  I did not know anyone had posted.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.