i'm not sure if this will help, but you can give it a try:
Code:
Function BackupSource()
'******************************************************************************
' *
'Author: Unknown *
'Modified By: Adam Evanovich *
'Date: 9/25/2010 *
'Purpose: To backup the source BackEnd file of a database *
' *
'Arguments: None *
' *
'******************************************************************************
On Error GoTo Err_BackupSource
Dim strBu As String
Dim buf As String
Dim MD_Date As Variant
Dim fs As Object
Dim strSourceName As String
Dim strSourceFile As String
Const conPATH_FILE_ACCESS_ERROR = 75
strSourceName = CurrentProject.Name
strSourceFile = CurrentProject.Path
buf = CurrentProject.Path & "\Backups\"
If GetAttr(buf) <> vbDirectory Then
MkDir buf
End If
Continue:
MD_Date = Format(Date, "yyyy-mm-dd ") & Format(time, "hh-mm-ss")
strSourceFile = CurrentProject.Path
strBu = CurrentProject.Path & "\Backups\" & MD_Date & "\"
MkDir (strBu)
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile strSourceFile & "\" & strSourceName, strBu
Set fs = Nothing
'Successful
MsgBox "Data backup at " & vbCrLf & MD_Date & vbCrLf & "successful!", _
vbInformation, "Backup Successful"
Exit_BackupSource:
Exit Function
Err_BackupSource:
If err.Number = conPATH_FILE_ACCESS_ERROR Then
MsgBox "The following Path, " & strBu & ", already exists or there was an Error " & _
"accessing it!", vbExclamation, "Path/File Access Error"
Else
If err.Number = 53 Then
MkDir buf
GoTo Continue
Else
MsgBox err.Description, vbExclamation, "Error Creating " & strBu
End If
End If
End Function '//LL