Log in

View Full Version : [SOLVED:] Error when backing up DB (not all users)



mykal66
11-19-2019, 06:36 AM
Hi

I added some code to the exit button on a database to automatically save a back up copy in separate location - code included with path removed.

For some reason it only works for about half of my team, others get a error message - screen shot attached.

Does anyone know why it works for some people and not others? Thank you
25437



Private Sub Command220_Click()
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 = "FILE PATH \"
Target = Target & "Enquiry Line " & Format(Date, "dd mmmm yyyy") & " " & Format(Time, "hh mm") & " " & Environ$("Username") & ".accdb"

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

OBP
11-19-2019, 07:00 AM
Hi, this sounds suspiciously like an MS Security Update issue ie different levels on different machines.
Although you can get similar issues with Drive & Folder permission differences.
So I would check the latest updates on the problem users computers compared to the OK ones and then check that everybody has the same permissions.

mykal66
11-19-2019, 08:36 AM
Hi.

Thank you, it was permission to the back up folder though not sure how as we cannot set our own permissions!

The users with issues could't access the folder manually so i just copied everything into a new folder and changed the file path to the new folder and it works for everyone now.

Thank you AGAIN for you help

Mykal

OBP
11-19-2019, 08:42 AM
Great :thumb