Results 1 to 3 of 3
  1. #1
    craig1988 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    82

    DELETE/KILL previous backups in specified folder

    Hi all

    I have a split database that is currently making a copy of the back end via an autoexec macro. It also adds a record to a backup table with dates, user, etc. It looks at the table first to see if a record with the same date exists and if it does exist, the back up does not occur. In essence it makes a daily backup.



    It gives the filename as such "GEIR_BACKUP_YYYY_MM_DD.accdb". What I would like to do is add to the autoexec macro so that it looks in the folder and deletes the previous backup. I do not need each daily backup only the latest.

    Can anyone help??

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    1. NEVER delete backups
    2.
    Code:
    vSrc = "\\server\folder\MyDb.accdb"
    vTarg = "\\server2\folder2\GEIR_BACKUP_" & format(date,"yyyy_mm_dd") & "_MyDb.accdb"
    
    Filecopy vSrc, vTarg

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Agreed! I currently have 112 backups of the FE/BE.

    The MINIMUM number of backups I would have at one time is 10 (two weeks if backed up daily). Then manually delete the oldest if more than 10 back ups.

    You must not be aware of the 3 rules of computing:
    The first rule is: Back up
    The second rule is: Back up
    and
    You guessed it - the third rule is BACK UP.


    I have a split database that is currently making a copy of the back end via an autoexec macro.
    You are using an autoexec macro to make a copy of an open BE???
    That is a recipe for disaster (corruption)!!. I would really be interested in exactly how you are doing the back ups.... if you care to share.

    When I open the FE, it is linked to the BE. I can tell that the BE is open because I have two lock file: one for the FE and one for the BE. Copying the BE (or the FE for that matter) while it is open (active) is really dangerous.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 09-09-2015, 03:25 AM
  2. Replies: 1
    Last Post: 05-15-2015, 10:58 AM
  3. Replies: 2
    Last Post: 10-10-2012, 02:51 PM
  4. open folder/Make new folder(example)-VBA Code
    By Madmax in forum Code Repository
    Replies: 3
    Last Post: 03-13-2012, 09:17 AM
  5. Replies: 6
    Last Post: 06-15-2011, 04:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums