Sub CreateBackup(Optional strDBType As String)
Dim strDBpath As String, ext As String, tmp As String
Dim strPath As String, strBackupPath As String, strDB As String
'tmp = CurrentDb.Name 'or maybe this should be the name of your BE
'strDBType = "FE"
strDBpath = GetAccessBE_PathFilename("tblUser")
'strPath = Left(strDBpath, InStrRev(strDBpath, "\"))
strPath = Left(strDBpath, Len(strDBpath) - InStrRev(strDBpath, "\") + 1)
strBackupPath = strPath & "Backup\"
'Will nor backup front and back end database
If strDBType = "FE" Then
strDBpath = CurrentDb.Name
End If
strDB = Right(strDBpath, Len(strDBpath) - InStrRev(strDBpath, "\"))
With CreateObject("Scripting.FileSystemObject")
'ext = "." & .GetExtensionName(tmp)
tmp = strBackupPath & Format(Now(), "yyyymmdd_hhnnss") & "_" & strDB
.CopyFile strDBpath, tmp
End With
MsgBox strDBType & " Database saved as " & tmp
End Sub