Results 1 to 4 of 4

Thread: Copy (95/97/2k)

  1. #1
    New Lounger
    Join Date
    Feb 2002
    Location
    Netherlands
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy (95/97/2k)

    I want to make a backup-module for my database: make automatically everyday 1 copy of the database, before using it, so in case of stupid-user-behaviour, I can put use an old database; ok, lose some days work, but that's worth the effort.

    Who can help?
    Which VBA-commands tu use? Replicate?

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Copy (95/97/2k)

    There isn't any facility for backup built into Access - you will need to use some sort of OS backup command, write your own using OS commands, or buy a commercial product to do the job. I understand a company called FMS has such a utility, though I don't have any personal experience with it.
    Wendell

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Copy (95/97/2k)

    The filecopy command will copy a complete file, but not while it is in use, so you can build a little utility database called backup.mdb, that simply makes a copy of another db to a floppy ( or other specified location) , and run it by putting this code on to a button on the main menu:
    MsgBox ("Ensure a floppy disk is in A drive.")
    retval = Shell("C:Program FilesMicrosoft OfficeOfficeMSACCESS.EXE c:databasebackup.mdb", 1)
    DoCmd.Quit
    This closes the current db and opens the backupdb.

    Backup has just one form, which is set to open automatically and display a message. In its onactivate event is the following code:
    DoCmd.Maximize
    Dim SourceFile, DestinationFile
    SourceFile = "C:databasemydatabase.mdb" ' Define source file name.
    DestinationFile = "A:mydatabase.mdb" ' Define target file name.
    DoCmd.Hourglass True
    FileCopy SourceFile, DestinationFile ' Copy source to target.
    DoCmd.Hourglass False
    DoCmd.Quit

    The code above is written for a floppy but you could specifiy any destination you like. The assumption behind this is that you backup after you have been using it. You could modify it to backup before using the db. In this case run backup first, then have it open the main db.

    If you want to keep all the old backups with different file names change the line
    DestinationFile = "A:mydatabase.mdb" ' Define target file name. to something like
    DestinationFile = "A:mydatabase" & format(date(),"dd/mmm/yyyy") & ".mdb" ' Define target file name.
    Regards
    John



  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copy (95/97/2k)

    Candace Tripp has a backup utility of sorts on her site at http://www.candace-tripp.com/access_downloads.htm
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •