Selasa, 11 Januari 2022

[MSAccessProfessionals] Error 70 permission denied

Hello all,

This morning i ran a piece of code that has been working for quite a long time and today i received a runtime error 70, Permission denied.
when I debug it is on
                retval = objFSO.CopyFile(Source, Target, True)
the source is a network folder

I tried changing the location to a folder on my c drive but I received the error anyway. It is part of an If statement but this has been working for a year now. Has there been another update that has caused this?

Is there something i need to change or is this a permanent situation?
Thank You for any advice offered.

Jim Wagner
Here is my code below

      Dim varX As Variant

        If DLookup("[RunReportDate]", "[tblPayDates]", "[RunReportDate] = Date()+1") Then
                MsgBox "The Hyperion dates will be changed and a copy of the database is being created. be patient until the message declares the database copy has completed"

                Dim Source As String
                Dim Target As String
                Dim retval As Integer

                Source = CurrentDb.Name

                'This is the only thing to change - add the path of where you want the file to save here
                'Target = "W:\ADMINISTRATIVE SERVICES DATABASES\MANAGEMENT SUPPORT SERVICES T-A-P\PAYROLL RECONCILIATION DATABASE\Archive\Backup_Payroll_Reconciliation_Database_"
                 Target = "C:\DirectReports\Backup_Payroll_Reconciliation_Database_"
                Target = Target & Format(Date, "mm-dd") & ".accdb"

                ' create the backup
                retval = 0
                Dim objFSO As Object
                Set objFSO = CreateObject("Scripting.FileSystemObject")
                retval = objFSO.CopyFile(Source, Target, True)
                Set objFSO = Nothing

                'Opens the folder of the file you just created
                'Application.FollowHyperlink "W:\ADMINISTRATIVE SERVICES DATABASES\MANAGEMENT SUPPORT SERVICES T-A-P\PAYROLL RECONCILIATION DATABASE\Archive\"
                Application.FollowHyperlink "C:\DirectReports\"

                MsgBox "Process has completed. " _
                & vbCrLf & vbCrLf _
                & "The database has been backed up into the Archives folder with the current date for example " _
                & "Backup_Payroll_Reconciliation_Database_09-03" _
                & vbCrLf & vbCrLf _
                & "The folder has opened for you to review the copied database", vbInformation, "Database Process"

        Else

                MsgBox "Data has updated"
                
        End If
_._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#116164) | Reply To Group | Reply To Sender | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [sugeng.panjalu.access@blogger.com]

_._,_._,_

Tidak ada komentar:

Posting Komentar