[AccessD] corrupt database - backup rather out-dated.

Bill Benson bensonforums at gmail.com
Wed Jun 4 20:25:51 CDT 2014


I don't think a single inputbox, presented at the time I decide to do a backup, will suffice for me unfortunately, Brad, at least not during the development cycle where I am making a LOT of fairly substantial changes. I really need a system of entering log details as they occur (design progress notes)... and writing to disk as a kind of change-log works better for the way I develop. It is pretty hard to remember what I have changed when I am asked, but nice that I can open up a text file and add a bit more when and as I think of it.

So going forward, I intend to take time writing more notes documenting the application, at least a few more comments. With a single double-click of a macro, I can write those notes to disk along with a copy of the database, and also export all the objects as shown in this thread:

http://www.access-programmers.co.uk/forums/showthread.php?t=99179

That, combined with my one-liner monstrosity: 

	CreateObject("Scripting.FileSystemObject").GetFile(CurrentDb.Name).Copy _
	left(currentdb.name,instrrev(currentdb.Name,"\")) & _
	"Backup_" & format(now(),"YYYY_MM_DD__hh_nn")& "_" & _
	mid(currentdb.name,instrrev(currentdb.Name,"\")+1)


The caveat is that the copy of the database on disk may not be 100% up to date. I have a little more testing of what behind-the-scenes (file system) copying accomplishes while a database is open. And yet, if I close the database, I cannot run the code (Catch-22). Unless I create a dictator application which performs the ExportAllObjects operations on the closed database remotely (or rather, opens and performs executes the procedure). 

I realize that what works for one person does not work for the next person, assuredly.


-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darryl Collins
Sent: Wednesday, June 04, 2014 7:40 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] corrupt database - backup rather out-dated.

Nice. Thanks Brad.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks
Sent: Wednesday, 4 June 2014 11:48 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] corrupt database - backup rather out-dated.

All,

I would like to share how I do backups. 

I have one key Access 2007 application called DBAM_Portal that I work on a lot.  On some days, I may make 10 or more changes to this application.  

I know that it is possible to make backups from within Access 2007 using the (Manage / Back Up Database) option.  When I back up the DBAM.Portal application with the built-in Backup option, the file name is something like DBAM_Portal_2014-06-04.accdb, DBAM_Portal_2014-06-04_(1).accdb, or DBAM_Portal_2014-06-04_(2).accdb depending on how many times I create a backup on any given day. 

This works Okay, but I also started keeping a log of what was changed in the application and how this change was tied to a given iteration of the backup files.

I decided to put together a small script to make it easier to do backups.  This script is written using an open source tool called AutoHotKey, but it could be built with several different tools.

The script that I have uses an Input Box to collect my note about what was just changed in the application before the backup is created.

The script also puts a date/time stamp in the file name.

Let’s say that I run the script and when the Inputbox is shown, I key in “Added Report800”.

The resulting name of the backup file would then look something like this.
C:\Backups of DBAM Portal\DBAM_Portal_Backup_Added Report800_Tue_Jun_03_2014_02_16_39_PM.accdb"     

I have used this approach for a couple years and it seems to work nicely.  I no longer need to keep a log of what each backup was for as this info is now contained right in the file name of the backup file.

Brad


Here is the AutoHotKey code.  
_ _ _ _ 

MySource = C:\DBAM Portal\DBAM_Portal.ACCDB

Inputbox , Variable1  

FormatTime , VarTimeString , ,  ddd_MMM_dd_yyyy_hh_mm_ss_tt

MyTarget = C:\Backups of DBAM Portal\DBAM_Portal_Backup_%Variable1%-%VarTimeString%.accdb

Filecopy , %MySource% ,  %MyTarget% , 1

_ _ _ _




More information about the AccessD mailing list