Sometimes I think those who post solutions benefit the most...here's an improved version of the above.
It will take 1. Backup Path parameter 2. Use linked table path or 3. Use Front End path in that order of preference
It's a boolean function so you can use its return to trigger other things if desired (warnings, etc.).
It has a boolean parameter for alerting upon successful completion (failure is always announced in this version).
[tt]Public Function MakeBackupCopy(p_Archive As Boolean, p_Alert As Boolean, _
Optional p_BackupPath As String) As Boolean
On Error GoTo Error_MakeBackupCopy
Const DATE_FORMAT As String = "_mmm-dd-yy-hhmmampm"
Const BACKUP_FOLDER As String = "\Backup"
Const BACKSLASH As String = "\"
Const UNDERSCORE As String = "_"
Const MSGBOX_HEADER as String = "Your App Name"
Dim strSourceFile As String
Dim strSourcePath As String
Dim strSourceFileWithPath As String
Dim strDateTag As String
Dim strTargetFile As String
Dim strTargetPath As String
Dim strTargetFileWithPath As String
Dim FSO As New FileSystemObject
Dim TDF As DAO.TableDef
MakeBackupCopy = False 'Set default
'SOURCE SECTION
If Len(p_BackupPath) Then
strTargetPath = p_BackupPath
Else
strSourceFile = CurrentProject.NAME 'Default value of Front End file
strSourcePath = CurrentProject.Path 'Default value of Front End path
'GetBackEnd Path of linked tables overwrite BEPath
For Each TDF In CurrentDb.TableDefs
If Len(TDF.Connect) Then
strSourceFile = TDF.Connect
'if password in Connect string there are 2 ='s so use Instr Reverse
strSourceFile = Mid(strSourceFile, (InStrRev(strSourceFile, "="

+ 1))
strSourcePath = Left(strSourceFile, ((InStrRev(strSourceFile, "\"

- 1)))
'One table is sufficient
Exit For
End If
Next
strTargetPath = strSourcePath 'if linked Back End put Backup there
End If 'check for backup path parameter
strSourceFileWithPath = strSourcePath & BACKSLASH & strSourceFile
'TARGET SECTION
strTargetFile = CurrentProject.NAME 'Use existing FE filename + date tag for TargetFile
strTargetFile = Left(strTargetFile, (Len(strTargetFile) - 4)) 'Remove File Extension
If p_Archive Then 'Overwrite one backup copy or archive w/ date tag?
strDateTag = Format(Date, "medium date"

& UNDERSCORE & Format(Now, "Short Time"

strTargetFile = strTargetFile & "_BAK" & UNDERSCORE & strDateTag & ".mdb"
Else
strTargetFile = strTargetFile & "_BAK" & ".mdb"
End If
strTargetPath = strTargetPath & BACKUP_FOLDER
strTargetFileWithPath = strTargetPath & BACKSLASH & strTargetFile
If Not (FSO.FolderExists(strTargetPath)) Then
FSO.CreateFolder strTargetPath
End If
FSO.CopyFile strSourceFileWithPath, strTargetFileWithPath
MakeBackupCopy = True 'If here then it worked
If p_Alert Then
MsgBox "Backup Completed" & vbCrLf & "Backup Copy:" & strTargetFileWithPath, _
vbInformation, MSGBOX_HEADER
End If
Exit_Error_MakeBackupCopy:
Set TDF = Nothing
Set FSO = Nothing
Exit Function
Error_MakeBackupCopy:
MakeBackupCopy = False
RespondToError "MakeBackupCopy", Err.Number, Err.Description, "Backup Failed"
Resume Exit_Error_MakeBackupCopy
End Function
[/tt]
Jeffrey R. Roberts
Insight Data Consulting
Access, SQL Server, & Oracle Development