Consulting

Results 1 to 3 of 3

Thread: Backup current front-end database

  1. #1
    VBAX Contributor
    Joined
    Oct 2011
    Location
    Concord, California
    Posts
    101
    Location

    Backup current front-end database

    I'm having a mental block and I know this has come up before. I'm creating a form with a button that when clicked, it backs up the current front-end database, but can't seem to get my head around it.
    If I use FileCopy strDatabaseName, strBackupName I get a "Permission Denied" error
    If I use DBEngine.CompactDatabase strDatabaseName, strBackupName I get "You attempted to open a database that is already open by use 'Admin'..."


    Any suggestions?

  2. #2
    What version of Access?

    The short answer is that you really can't properly backup or copy a file when it is open.

    This means you will need to close the database before you run your backup software or try to make a copy for the file. One way to do this is to have the front end call a DOS bat/cmd file that copies or backups up the front end and then reopens it. Something similar to FRONT-END AUTO-UPDATE ENABLING TOOL found here: http://www.btabdevelopment.com/ts/freetools

    Curious, why you you need to backup or copy the front end?

    I deploy all my front ends compiled (MDE/ACCDE) with no local data. There really is no need to back up the local copy of a front end since it can't be changed.. I regular copy a new version of the front end to the local hard drives. The only front end I need to back up is the master copy. I have yet to have the need to do what you are asking in 15+ years deplying Access applicaitions.
    Boyd Trimmell aka HiTechCoach
    Microsoft Access MVP -2010-2015

    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  3. #3
    VBAX Contributor
    Joined
    Oct 2011
    Location
    Concord, California
    Posts
    101
    Location
    Thanks for your reply.

    What I ended up doing is the following:

    Using the Scripting File Object, I created a copy of the database, while opened, giving it a temporary name.
    I then took the temporary copy of the database, and using DBEngine.CompactDatabase, I created my compacted backup database.

Posting Permissions

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