I think I've posted this sometime in the past but it might be useful again here. This is a simple routine that is fired on closing the database, when it creates a dated backup folder and copies itself there. I also set the database to Compact on Close in Tools > Options, which only works when the last user closes out of the database. The routine has some limitations:
- It only stores one backup a day. If the database is closed more than once, earlier backups that day are overwritten. You can add more sections if necessary, using time functions, such as Hour(Now()).
- You could create one folder per day with a longer name instead of a tree or simply rename the database by adding a date/time stamp to the filename. The code is (hopefully) adequately commented.
- There is no retrospective cleaning up; backups are simply created and never deleted. There is therefore an onus on the administrator to archive or delete old backups. I zip completed years and archive them onto CD/DVD.
- The Compact on Close runs after the backup routine, so the backed-up database is not compacted. As this is set to happen every time the database is closed, it should never be that bad but it does mean that Access takes a little longer to close.
I'm open to questions; my email address is in the code or you can PM me here. This is offered as a solution that I figured out for myself and that works for me; no guarantees attached or implied!