Roger's Access Library Homepage
Forum Home Forum Home > Other Download Libraries > MS Access MVP Libraries > Tejpal, A.D.
  New Posts New Posts RSS Feed - SelfSaveAddIn
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Please consider donating $1 per sample downloaded, (find out why here)


 Post Reply Post Reply
A.D. Tejpal View Drop Down
Microsoft MVP
Microsoft MVP

Joined: 30 Jun 2008
Status: Offline
Points: 192
Post Options Post Options   Thanks (0) Thanks(0)   Quote A.D. Tejpal Quote  Post ReplyReply Direct Link To This Post Topic: SelfSaveAddIn
    Posted: 06 Jul 2008 at 10:57pm
Version 1.4 (Updated on 04-Jan-2011)
Explanatory Notes
    This utility enables creation of periodic backup copies of the running database (as well as all its back ends if any - if so desired). Interval of auto alerts (in minutes) can be set by the user as desired. At auto alert stage, the backup form pops up, with a message box asking the user to close all activity, ensure there is no other user, get out of VBA window and click the backup button. (The message box comes up even when the user is in VBA window).
    If the user closes the backup form without actually performing the backup, auto alert period gets reset to one minute, causing persistent reminders every minute. Once the backup is done and the form closed, auto alert interval reverts back to normal value originally set by the user.
    If desired, the backup copies can be compacted before backup, apart from getting stamped with current Date or DateTime. If the user has selected DoCompact check box, the AddIn creates a compacted back up file  with "_CpBk_" embedded in its suffix. If, for any reason, the back process is not successful, normal copy gets done with "_Bk_" embedded in its suffix. By looking at the name of backed up file, the user can determine whether compaction was a success (Presence of "Cp" in the suffix).
    Note: Safe compaction technique is used, so that even if the process fails, the original file remains un-affected. In such an eventuality, the backup gets done without compaction.
    If DoCompact option is selected and the host db has a password, it will be needed as one of the arguments in compaction statement. The user will have to enter this password only once during a given session. If the host db is linked to one or more back ends, and some or all of these are password protected, all the back ends will get compacted and backed up, using the passwords extracted from relevant connection strings.
    Old backup files in excess of the maximum limit set by the user, get deleted simultaneously. Backup folder can be prescribed by the user. After each backup, latest count of backup files, apart from particulars of last backup, is displayed.
    On click of a button, the user can see the list of all files existing in backup folder. Files <= 8 Hrs old are highlighted in light green, those > 8 Hrs and <= 24 Hrs old are in orange color while others ( > 24 Hrs old) are shown in grey color.
Version: Access 2000 file format.
References: DAO 3.6, Microsoft Scripting RunTime
    The folder SelfSaveAddIn should be put directly on the C: drive, so that the path for .mda file is -
C:\SelfSaveAddIn\SelfSaveAddIn.mda. (This is important, so as to establish the correct registry key)
    Open any database in Access and click on Tools > Add-Ins > Add-In Manager.
    Click on Add New. Browse to the folder and file at C:\SelfSaveAddIn\SelfSaveAddIn.mda
    Click OK. This will copy the .mda file to Microsoft's default Add-in folder for Access.
    You have to do this only once.
    To use SelfSaveAddIn from within any database, click Tools > Add-Ins > SelfSaveBackUp
Technical Notes:
    Certain interesting factors pertaining to Add-Ins in general, are mentioned below: 
    1 - For code contained in modules belonging to the Add-In:
        (a) If the AddIn is opened independently, CurrentProject / CurrentDb are identical to CodeProject / CodeDb respectively (all refer to AddIn itself).
        (b) If the AddIn is activated in host db, CurrentProject / CurrentDb refer to host db while CodeProject / CodeDb refer to AddIn itself.
        (c) Host applications AllForms / AllReports / AllModules collections can be accessed by code in AddIn, using CurrentProject.
        (d) Tables / Queries are not covered by collections like those in prev para.
        (e) While the AddIn is in activated state, any query / table / form / report, whether in host db or in the AddIn, as well as modules in host db can be opened directly by name, using DoCmd statement in AddIn code, without having to use any special qualifier.
        (f) If any pair of similar objects exists both in the AddIn as well as the host db, code in AddIn module will act upon the object located in the AddIn itself.
        (g) For code in AddIn module, when the AddIn is in activated mode, queries / recordests based upon CurrentDb do not recognize the tables in AddIn itself, unless referred via IN clause, giving full path of the AddIN. This path, returned by CodeProject.FullName, refers to the original location of AddIn mda file e.g. C:\SelfSaveAddIn\SelfSaveAddIn.mda and not the shadow AddIn file in AddIns folder in MyDocuments. There is no such problem if queries / recordsets are based upon CodeDb instead of CurrentDb.
        (h) Modules belonging to the AddIn can not be opened by DoCmd mehod or otherwise addressed, even by code in the AddIn. DoCmd.CopyObject command can however be used for copying modules from AddIn to host db.
    2 - For code contained in modules belonging to the host db:
        (a) CurrentProject / CurrentDb are identical to CodeProject / CodeDb respectively, always referring to the host db, irrespective of the fact whether the AddIn is in activated state or not.
        (b) Whereas code in the AddIn can access all tables / queries / forms / reports, whether belonging to AddIn or the host db (see para 1 (e) above), code in host db can directly access only the objects belonging to host db itself. 
    Note:  General module named basCommDlg, an adaptation from Access Developer's Handbook, has been kindly provided by Bill Mosca
Download Access 2000: uploads/37/

Back to Top
Sponsored Links

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.