Sent: Tuesday, January 11, 2022 3:58 PM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Error 70 permission denied
Jim
What about permissions on the Source folder? Can you manually copy the current DB to your target? If the file is in use (which it obviously is if you re using CurrentDB) maybe that is where the hang-up is.
Regards,
Bill Mosca
From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of luvmymelody via groups.io
Sent: Tuesday, January 11, 2022 2:41 PM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Error 70 permission denied
Bill,
Thank You for the compliment. Not every piece of code is formatted like that but it helps me to read it.
So I do not see anything wrong when i hover on the reval line everything is looking at the correct date and the source is correct. that is why I changed to the c drive for the thought that the network drive was not connected or something else. but I am getting the same error.
Jim Wagner
On Tuesday, January 11, 2022, 08:06:33 AM MST, Jim Wagner <josephwagner2@outlook.com> wrote:
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
Tidak ada komentar:
Posting Komentar