You cannot back up (copy or zip) an open Access file, so an Access .mdb file cannot back itself up. You could write a .bat file that backed up the .mdb file before it started it but then it would take a couple of seconds to start. There are tools from FMS (www.fmsinc.com) that help with maintenance (Total Access Admin). I haven't used that tool but other FMS products are high quality. Within Access code you can export objects including tables and code modules so you can do limited sorts of "backups" depending on your intention. We do that all the time where we number the backups to not write over the previous backups.
My goal is this. Awhile back I asked the question about access security. My question was how can I protect the folder my dbase is in while still letting people from different terminals acces the db. I got not response. I have tried to protect the file but was unable to and still maintain useability. So I want to be able to backup the db often just in case a disgruntled worker decides to delete the db.
Did I confuse you as much as I think I just confused myself?
While browsing for sample databases I found this backup demo posted by OLDSOFTBOSS. It is for backing up open databases. I am VB illiterate, can anyone show me the way to set this up for my own application? Right now it is set up to backup winzip.
I checked with one of my partners since he does our backup solutions. I didn't think one could back up/copy an open Access database but he says you can do it, but NOT RELIABLY. That is, Access data may still be in a main memory buffer and not flushed to the database yet, so you may be getting partial records/indexes and inconsistent data. We check the .ldb file before doing the backup (if the .ldb file is not there then no one is using the database).
For security, there are many layers to be concerned with. If you have an NTFS file system (rather than FAT32) you can use Access control lists (ACLs) to control user permissions on the folder. From Windows Explorer, highlight the folder, right click, choose properties, then the Security tab. Add the user/group that you want to restrict, then for that user/group click the Advanced button and give them the needed permissions but do NOT give them "Delete" or "Delete Subfolders and Files" permissions. You will need to play around with a test application to get the permissions right.
But, of course, if they have Access they can still get it and delete rows/tables, etc. So you have to protect the Access application also. And if the users are smart enough, then can connect to the database from Excel or other apps and delete critical data. So, there are many layers of protection. The first stage is using Access security to prevent users from getting outside of your forms. I recommend the Litwin/Getz 2 book set as the starting book. If you really want to, you can even have Access encrypt your data so that only Access (and not Excel, etc) can read it.
In Access forms you can decide (without coding) to only allows users to add data but not view/edit existing data (the Data Entry property, in conjuction with the Allow Additions/Allow Deletions/Allow Edits properties). If you write code you can get more sophisticated about granting permissions and doing an audit trail.
So, making copies/backups of the database regularly is a great idea. The sample code you posted does that, but if your files are in a fixed location you can just run .bat (batch) files just as easy. You can set up a Scheduled Task in the Control Panel and get as sophisticated as needed e.g. check the .ldb, run a .zip or copy, develop a naming convention, delete files older than x days old, etc.
The long and short, bullet-proofing yourself from malicious users is difficult.