I want to backup a database called Sudweeks. Sudweeks is on a USB stick because it goes between two computers, one on site and one off site. I want to backup onto the hard drive of each computer on exiting the database to : C:\Documents And Settings\My Documents\Sudweeks.
I have made the following code, don't know if I am supposed to prefix it with anything, it needs to activate when I click on a button called Backup.
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 = Sudweeks.Name
sSourcePath = Sudweeks.Path & "\"
sBackupFile = Sudweeks.Name
sBackupPath = C:\Documents And Settings\ My Documents\Sudweeks.Path
buf = Sudweeks.Path & "\Backups\"
Set fso = CreateObject
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
Private Sub Backup_Click()
End Sub