Hi all i tried creating a backup code with vba, but i get this message
"FILE NOT FOUND", this is confusing as i feel i've put everything in place.
This my code:
Function BACKUPS()
Dim fso As Object
Dim sSourcePath As String
Dim sSourceFile As String
Dim sBackupPath As String
Dim sBackupFile As String
Dim db As New Access.Application
Dim buf As String
Dim strBu As String
sSourceFile = CurrentProject.Name
sSourcePath = CurrentProject.Path
sBackupFile = CurrentProject.Name
sBackupPath = CurrentProject.Path
buf = CurrentProject.Path & "\Backups\"
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile sSourcePath & sSourceFile, sBackupPath & sBackupFile, True
Set fso = Nothing
Beep
MsgBox "Backup was successful and saved @ " & Chr(13) & Chr(13) & sBackupPath & Chr(13) & Chr(13) & "The backup file name is " & Chr(13) & Chr(13) & sBackupFile, vbInformation, "Backup Completed"
End Function
Any help would be highly appreciated
"FILE NOT FOUND", this is confusing as i feel i've put everything in place.
This my code:
Function BACKUPS()
Dim fso As Object
Dim sSourcePath As String
Dim sSourceFile As String
Dim sBackupPath As String
Dim sBackupFile As String
Dim db As New Access.Application
Dim buf As String
Dim strBu As String
sSourceFile = CurrentProject.Name
sSourcePath = CurrentProject.Path
sBackupFile = CurrentProject.Name
sBackupPath = CurrentProject.Path
buf = CurrentProject.Path & "\Backups\"
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile sSourcePath & sSourceFile, sBackupPath & sBackupFile, True
Set fso = Nothing
Beep
MsgBox "Backup was successful and saved @ " & Chr(13) & Chr(13) & sBackupPath & Chr(13) & Chr(13) & "The backup file name is " & Chr(13) & Chr(13) & sBackupFile, vbInformation, "Backup Completed"
End Function
Any help would be highly appreciated