Hi,
Please what is the right synthax to backup only the backend of my database.
This is the code i try using, but it only backup the frontend and my database is splitted and in different folders on a network:
Public Function db_backup()
Dim sourceFile As String, destinationFile As String
Dim aFSO As Variant
Dim path As String, name As String
sourceFile = CurrentProject.FullName
path = CurrentProject.path
name = CurrentProject.name
destinationFile = "CurrentDb" & _
Left(name, Len(name) - 6) & "_backup" & "_" & _
Year(Now) & "_" & Month(Now) & "_" & Day(Now) & ".accdb"
'this removes a file created on the same day
If Dir(destinationFile) <> "" Then
Kill destinationFile
End If
'this creates a backup into destination path
If Dir(destinationFile) = "" Then
Set aFSO = CreateObject("Scripting.FileSystemObject")
aFSO.CopyFile sourceFile, destinationFile, True
MsgBox "A database backup has been stored under " & _
destinationFile
End If
End Function
Thank you in advance.
Please what is the right synthax to backup only the backend of my database.
This is the code i try using, but it only backup the frontend and my database is splitted and in different folders on a network:
Public Function db_backup()
Dim sourceFile As String, destinationFile As String
Dim aFSO As Variant
Dim path As String, name As String
sourceFile = CurrentProject.FullName
path = CurrentProject.path
name = CurrentProject.name
destinationFile = "CurrentDb" & _
Left(name, Len(name) - 6) & "_backup" & "_" & _
Year(Now) & "_" & Month(Now) & "_" & Day(Now) & ".accdb"
'this removes a file created on the same day
If Dir(destinationFile) <> "" Then
Kill destinationFile
End If
'this creates a backup into destination path
If Dir(destinationFile) = "" Then
Set aFSO = CreateObject("Scripting.FileSystemObject")
aFSO.CopyFile sourceFile, destinationFile, True
MsgBox "A database backup has been stored under " & _
destinationFile
End If
End Function
Thank you in advance.