Results 1 to 5 of 5
  1. #1
    Mearntain is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jul 2015
    Posts
    52

    Auto Save of Access Database to different location


    In my access database, I have a homepage which has an "exit program" button that closes access all the way down. What I would like to do, if possible, is when this exit button is pressed, that a copy of this access database is placed in a designated location. So not only would my database be constantly updating to its original location as records are updated, but when the exit button is pressed ( and only when the exit button is pressed), a second copy of the file is placed at a 2nd location. I'm half decent with VBA, but this is beyond the scope of what I know. Thanks in advance!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    in the EXIT button, the code should have
    DoCmd.Quit

    BEFORE this statement, put the file copy
    FILECOPY src, target

  3. #3
    Mearntain is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jul 2015
    Posts
    52
    I tried using this before, but I always get Permission Denied error message. Do you know why this is? I have permissions to all the target locations I have tried. I have tried sending it to the network directly, mapped drives on the network, and straight to my C drive. None will work. I am using:

    Code:
    FileCopy "C:\Users\davidr\Desktop\dept 40 log.mdb", "\\MGEADC1\Manuf-Eng\Rowe\WCWT"

  4. #4
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    try copying a different source file. If that works, then it's probably because you access file is locked.
    Do you have front end/back end or a single file?
    you may be able to delete the .ldb file and then do the copy.

  5. #5
    Mearntain is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jul 2015
    Posts
    52
    I ended up using the code below, and have everything working great now. Thanks for the input from you both!

    Code:
      Dim xlobj As Object    Set xlobj = CreateObject("Scripting.FileSystemObject")
        xlobj.CopyFile "C:\Users\davidr\Desktop\dept 40 log.mdb", "\\MGEADC1\Manuf-Eng\Rowe\dept 40 log.mdb", True
        Set xlobj = Nothing

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

Similar Threads

  1. Replies: 2
    Last Post: 06-18-2013, 09:06 AM
  2. Change Primary Location of Access Database
    By MichaelWR90 in forum Access
    Replies: 8
    Last Post: 06-03-2013, 09:45 AM
  3. Save an email in an Access database
    By CindyR19 in forum Programming
    Replies: 2
    Last Post: 09-01-2011, 05:25 PM
  4. Replies: 0
    Last Post: 03-01-2011, 10:47 AM
  5. Auto Save MS Access 2007
    By BlindLady in forum Access
    Replies: 2
    Last Post: 02-27-2011, 06:44 AM

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