Backup database

K

kateri4482

Is there a way to write Visual Basic code to backup the database? I have a
command button that copies a table and then deletes some information from a
few fields, but I would like to make a copy of the entire database before I
run this code. I have been backing it up manually but would like not to. If
so, how do I write that? Thanks!
 
S

strive4peace

not if you have the database open -- that I know of anyway.

do something like this:

make a directory called BAK below the database directory

name the database like this:
dbname_yymmdd_h.mdb
OR
dbname_yymmdd_hhnn.mdb

WHERE
dbname is a short identifier for the database
yymmdd is Year, Month Day
hhnn is Hour (24-hr clock) and miNutes

rename the database to the current date/time stamp before you open it

ctrl-drag the db to the BAK directory (make sure you are holding CTRL
when you let go of the mouse and a copy will be made)

you may wish to rename the backup to something like this:

dbname_yymmdd_hhnn_before_delete_tblname.mdb

then do your stuff!

I backup databases every hour or two while I am developing -- and more
frequently if I am deleting lots of data :)


Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top