Brad Marks
bradm at blackforestltd.com
Thu Jun 5 11:07:13 CDT 2014
Bill, Thanks for your reply. You got me thinking about the situations where it would be beneficial to be able to record more detailed notes when a backup is generated. I enhanced my backup script to include two text-boxes. One for a short description and one for lengthy notes. I used the AutoHotKey "GUI" feature for this. The script now creates a "History" file which includes the date/time stamp, the file name of the backup file, the short description, and the notes field. Below is the actual code. I am glad that we exchanged ideas on how to do backups as I now have a better script that creates a history file. Brad ~~~~~~~~~~~~~~~~~~ AutoHotKey Code ~~~~~~~~~~~~~~~~~~~~~ Gui , Add , Edit , r1 W450 vShortText Gui , Add , Edit , r30 W450 vLongText Gui , Add , Button , gButtonPushed , Create Backup Gui , Show Return ButtonPushed: Gui , Submit , NoHide FormatTime, VarTimeString,, ddd_MMM_dd_yyyy_hh_mm_ss_tt MySource = C:\DBAM_Portal.ACCDB MyTarget = C:\Backups of DBAM Portal\DBAM_Portal_Backup_%ShortText%_%VarTimeString%.accdb MyHistory = C:\Backups of DBAM Portal\DBAM_Portal_Backup_History.txt FileAppend Date/Time = %VarTimeString% `nBackup File = %MyTarget% `nShort Description = %ShortText% `nNotes = %LongText% `n`n`n , %MyHistory% Filecopy, %MySource%, %MyTarget%,1 ExitApp Return ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Wednesday, June 04, 2014 8:26 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] corrupt database - backup rather out-dated. 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 _ _ _ _ -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com