Results 1 to 14 of 14
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097

    Error 70 with FileCopy


    Colin once posted that Error 70 could mean invalid target file name. I don't see anything wrong with either the code statement or the two file names. Have I missed something here?

    Code:
        If Len(Dir(strBkUpName)) > 0 Then Kill (strBkUpName)
        FileCopy TMSClientDB, strBkUpName
    Code:
    PostError:
        Open TMSClientPath & "AutoLogs.txt" For Append As #1
        Print #1, "TMS DB/Im Backups " & Date & " " & Time()
        Print #1, "Backing up: " & TMSClientDB
        Print #1, "To backup file: " & strBkUpName
        Print #1, "ERROR: " & strOpMsg
        Print #1, "Error Number: " & Err.Number
        Print #1, "Error Description: " & Err.Description
        Print #1, "Now terminating backup process."
        Close #1
    And the log:
    Code:
    TMS DB/Im Backups 1/30/2025 4:39:49 PM
    Backing up: C:\TMS\TMS-Clients\SCC\SCC Data.mdb
    To backup file: E:\My Drive\SCC BkUps\05Thu_SCC_Data.mdb
    ERROR: 
    Error Number: 70
    Error Description: Permission denied
    Now terminating backup process.
    Same error with 3 other client DB's. All folder names verified by Explorer inspection. Some on local drives and a couple on Google Drive.

  2. #2
    jojowhite's Avatar
    jojowhite is online now Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    434
    the error description is suggestive enough, maybe you don't have access right to create a file on that folder.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097
    Code works fine using FileSystemObject. Still would like to know why FileCopy is failing?
    Code:
        Set fso = CreateObject("Scripting.FileSystemObject")
        fso.copyfile TMSClientDB, strBkUpName
        'FileCopy TMSClientDB, strBkUpName

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    It fails because TMSClientDB is open. Plenty of links online if you google it

    https://learn.microsoft.com/en-us/of...copy-statement





  5. #5
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Quote Originally Posted by GraeagleBill View Post
    Colin once posted that Error 70 could mean invalid target file name.
    Did I? In what context?
    Access error 70 is Permission denied
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  6. #6
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097
    Runtime error 70
    https://www.access-programmers.co.uk...ror-70.327493/

    Your comment about invalid file path.

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097
    It would seem then that I can't copy the BE from code in the FE. How is it that the FSO method doesn't also encounter the Error 70? Also, if I use the DoCmd method to close, that results in an immediate Quit of the current app. I guess I'm a little bit "out on a limb" here?

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Quote Originally Posted by GraeagleBill View Post
    It would seem then that I can't copy the BE from code in the FE. How is it that the FSO method doesn't also encounter the Error 70? Also, if I use the DoCmd method to close, that results in an immediate Quit of the current app. I guess I'm a little bit "out on a limb" here?
    IF you had read that thread, you will see i posted code that would backup the BE or FE from within the FE?
    So if that does not work for you, then you do have access permission issues.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #9
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097
    IF you had read that thread
    I'd be happy to, but which thread are you referring?

    BTW, if I momentarily relink the BE, will that effectively release the locks and thereby allow the copy?

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    The thread link that you posted?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  11. #11
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    How is it that the FSO method doesn't also encounter the Error 70?
    because it is a different method

  12. #12
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    If I try and copy my db I am in with this
    filecopy "f:\users\paul\documents\diabetes.accdb", "f:\temp\tt.accdb"

    i too get error 70

    From Google https://learn.microsoft.com/en-us/of...copy-statement

    Remarks


    If you try to use the FileCopy statement on a file that is currently open, an error occurs.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  13. #13
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097
    Ah Yes! I saw the "Compact and Repair" at the head of the thread and moved on thinking "not what I'm trying to do".

  14. #14
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097
    I think I'll settle for the FSO approach to solve the issue. The code is in a general module and by the time it executes the user's interactions have long quiesced to the point where the DB is essentially idle.

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

Similar Threads

  1. Replies: 4
    Last Post: 01-24-2016, 07:41 PM
  2. Faster way to copy a file than FileCopy()
    By kdbailey in forum Access
    Replies: 10
    Last Post: 10-29-2015, 07:20 AM
  3. Replies: 1
    Last Post: 03-18-2014, 05:16 PM
  4. FileCopy
    By thescottsman92 in forum Access
    Replies: 1
    Last Post: 09-02-2013, 04:35 PM
  5. FileCopy Funtion
    By dccjr in forum Programming
    Replies: 2
    Last Post: 04-18-2013, 09:04 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