Backup code
Cosmos,
I got the code from someone on tek-tips. I will post it below. If you send me your email I will send you the email I got so you can see the additional notes he gave me.
sharon@entechcomputers.com
-------
Option Compare Database
Option Explicit
Private Const FO_COPY = &H2
Private Const FOF_SIMPLEPROGRESS = &H100
Private Const FOF_NOCONFIRMATION = &H10
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" _
(lpFileOp As SHFILEOPSTRUCT) As Long
Private Type SHFILEOPSTRUCT
hWnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Boolean
hNameMappings As Long
lpszProgressTitle As String
End Type
Dim x As SHFILEOPSTRUCT
Private Sub Command0_Click()
On Error Resume Next
Dim fso1
Dim FileNameX As String
Dim strFilter As String
Dim strInputFileName As String
Dim StrsaveFileName
Dim filex As String
Set fso1 = CreateObject("Scripting.FileSystemObject")
fso1.CreateFolder ("C:\SharonTest\") 'This is the default directory where the file will be saved
FileNameX = "TestFile" & Month(Now()) & "-" & Day(Now()) & "-" & Year(Now()) & "_" & Hour(Now()) & "_" & Minute(Now()) & "_" & Second(Now()) 'This is the default filename with a date time stamp
strFilter = ahtAddFilterItem("Export ", "Access Files (*.mdb)", "*.mdb")
StrsaveFileName = ahtCommonFileOpenSave(ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY, "C:\SharonTest\", strFilter, , , FileNameX, , , False)
filex = StrsaveFileName
x.pFrom = "C:\Backend.mdb" 'This is the location of your backend mdb.
x.pTo = StrsaveFileName
x.fFlags = FOF_NOCONFIRMATION
x.wFunc = FO_COPY
SHFileOperation x
MsgBox "Backup Complete", vbOKOnly, "Status"
End Sub
Private Sub Command61_Click()
On Error GoTo Err_Command61_Click
DoCmd.Close
Exit_Command61_Click:
Exit Sub
Err_Command61_Click:
MsgBox Err.Description
Resume Exit_Command61_Click
End Sub