G
Guest
Ive tried several different ways but had no luck
What is the best way to backup an access2003 database from a cmd button??
What is the best way to backup an access2003 database from a cmd button??
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Danny J. Lesandrini said:Here's what I do ...
Public Function CreateBackupFile() As Boolean
On Error GoTo Err_Handler
Dim strSBackupFolder As String
Dim strSSource As String
Dim strSTarget As String
Dim strSMsg As String
Dim frm As Form
Dim objFSO As FileSystemObject
Dim objFile As File
Dim strSTimeTag As String
DoCmd.Hourglass True
strSTimeTag = Format(Now(), "_yy-mm-dd_hh-nn")
Set objFSO = New FileSystemObject
strSBackupFolder = DLookup("[BackupFolder]", "[usysVersionServer]")
' backup current client file
strSSource = CurrentDb.Name
strSTarget = strSBackupFolder & gcstr_ClientFile & strSTimeTag & ".mdb"
Set objFile = objFSO.GetFile(strSSource)
objFile.Copy strSTarget
Set objFile = Nothing
' backup primary data file
strSSource = Mid(CurrentDb.TableDefs("tblAgent").Connect, 11)
strSTarget = strSBackupFolder & gcstr_DataFile & strSTimeTag & ".mdb"
Set objFile = objFSO.GetFile(strSSource)
objFile.Copy strSTarget
Set objFile = Nothing
Set objFSO = Nothing
DoCmd.Hourglass False
Exit_Here:
Exit Function
Err_Handler:
MsgBox Err.Description
Resume Exit_Here
End Function
--
Danny J. Lesandrini
(e-mail address removed)
http://amazecreations.com/datafast/
StuJol said:Ive tried several different ways but had no luck
What is the best way to backup an access2003 database from a cmd button??
Karl H said:This is helpful, but I need the reference for FileSystemObjects. Do you
know
where in the library of references this is found?
Thank you,
Karl
Danny J. Lesandrini said:Here's what I do ...
Public Function CreateBackupFile() As Boolean
On Error GoTo Err_Handler
Dim strSBackupFolder As String
Dim strSSource As String
Dim strSTarget As String
Dim strSMsg As String
Dim frm As Form
Dim objFSO As FileSystemObject
Dim objFile As File
Dim strSTimeTag As String
DoCmd.Hourglass True
strSTimeTag = Format(Now(), "_yy-mm-dd_hh-nn")
Set objFSO = New FileSystemObject
strSBackupFolder = DLookup("[BackupFolder]", "[usysVersionServer]")
' backup current client file
strSSource = CurrentDb.Name
strSTarget = strSBackupFolder & gcstr_ClientFile & strSTimeTag &
".mdb"
Set objFile = objFSO.GetFile(strSSource)
objFile.Copy strSTarget
Set objFile = Nothing
' backup primary data file
strSSource = Mid(CurrentDb.TableDefs("tblAgent").Connect, 11)
strSTarget = strSBackupFolder & gcstr_DataFile & strSTimeTag & ".mdb"
Set objFile = objFSO.GetFile(strSSource)
objFile.Copy strSTarget
Set objFile = Nothing
Set objFSO = Nothing
DoCmd.Hourglass False
Exit_Here:
Exit Function
Err_Handler:
MsgBox Err.Description
Resume Exit_Here
End Function
--
Danny J. Lesandrini
(e-mail address removed)
http://amazecreations.com/datafast/
StuJol said:Ive tried several different ways but had no luck
What is the best way to backup an access2003 database from a cmd
button??
Brendan Reynolds said:The reference you need is 'Microsoft Scripting Runtime'.
--
Brendan Reynolds
Karl H said:This is helpful, but I need the reference for FileSystemObjects. Do you
know
where in the library of references this is found?
Thank you,
Karl
Danny J. Lesandrini said:Here's what I do ...
Public Function CreateBackupFile() As Boolean
On Error GoTo Err_Handler
Dim strSBackupFolder As String
Dim strSSource As String
Dim strSTarget As String
Dim strSMsg As String
Dim frm As Form
Dim objFSO As FileSystemObject
Dim objFile As File
Dim strSTimeTag As String
DoCmd.Hourglass True
strSTimeTag = Format(Now(), "_yy-mm-dd_hh-nn")
Set objFSO = New FileSystemObject
strSBackupFolder = DLookup("[BackupFolder]", "[usysVersionServer]")
' backup current client file
strSSource = CurrentDb.Name
strSTarget = strSBackupFolder & gcstr_ClientFile & strSTimeTag &
".mdb"
Set objFile = objFSO.GetFile(strSSource)
objFile.Copy strSTarget
Set objFile = Nothing
' backup primary data file
strSSource = Mid(CurrentDb.TableDefs("tblAgent").Connect, 11)
strSTarget = strSBackupFolder & gcstr_DataFile & strSTimeTag & ".mdb"
Set objFile = objFSO.GetFile(strSSource)
objFile.Copy strSTarget
Set objFile = Nothing
Set objFSO = Nothing
DoCmd.Hourglass False
Exit_Here:
Exit Function
Err_Handler:
MsgBox Err.Description
Resume Exit_Here
End Function
--
Danny J. Lesandrini
(e-mail address removed)
http://amazecreations.com/datafast/
Ive tried several different ways but had no luck
What is the best way to backup an access2003 database from a cmd
button??
Danny J. Lesandrini said:Here's what I do ...
Public Function CreateBackupFile() As Boolean
On Error GoTo Err_Handler
Dim strSBackupFolder As String
Dim strSSource As String
Dim strSTarget As String
Dim strSMsg As String
Dim frm As Form
Dim objFSO As FileSystemObject
Dim objFile As File
Dim strSTimeTag As String
DoCmd.Hourglass True
strSTimeTag = Format(Now(), "_yy-mm-dd_hh-nn")
Set objFSO = New FileSystemObject
strSBackupFolder = DLookup("[BackupFolder]", "[usysVersionServer]")
' backup current client file
strSSource = CurrentDb.Name
strSTarget = strSBackupFolder & gcstr_ClientFile & strSTimeTag & ".mdb"
Set objFile = objFSO.GetFile(strSSource)
objFile.Copy strSTarget
Set objFile = Nothing
' backup primary data file
strSSource = Mid(CurrentDb.TableDefs("tblAgent").Connect, 11)
strSTarget = strSBackupFolder & gcstr_DataFile & strSTimeTag & ".mdb"
Set objFile = objFSO.GetFile(strSSource)
objFile.Copy strSTarget
Set objFile = Nothing
Set objFSO = Nothing
DoCmd.Hourglass False
Exit_Here:
Exit Function
Err_Handler:
MsgBox Err.Description
Resume Exit_Here
End Function
--
Danny J. Lesandrini
(e-mail address removed)
http://amazecreations.com/datafast/
StuJol said:Ive tried several different ways but had no luck
What is the best way to backup an access2003 database from a cmd button??
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.