Author : Esmael Telmosa
Date Submitted : 6/16/2006
Category : Database
Compatibility : .NET
This code has been accessed 11737 times.
Task : Procedure to back-up database (for MS Access)
Declarations
Code
Sub BackUpDBase(CommondialogControl, StrSource As String)
'CommondialogControl = CommondialogControl
'Ask the filename of Back-Up
CommondialogControl.Filter = "Back-Up Files (*.mdb)|*.mdb"
'Set Default DIR
CommondialogControl.InitDir = "C:\"
'Display the SHOWSAVE window
CommondialogControl.ShowSave
On Error GoTo Opps
'If there is an entry
If CommondialogControl.FileName <> "" Then
'if already exist then delete the file
If Dir(CommondialogControl.FileName) <> "" Then Kill CommondialogControl.FileName
' 'repair database
'' DBEngine.RepairDatabase "C:\Documents and Settings\allen\Desktop\mitch-barcode\monitoringdbCon.mdb"
FileCopy StrSource, CommondialogControl.FileName
'Text1.Text = CommondialogControl.FileName
'Prompt to User that Back_Up is Completed
MsgBox "Back-Up Complete!", vbInformation, "BACK-UP SUCCESSFUL"
End If
Exit Sub
Opps:
MsgBox Err.Description, vbExclamation, "Employee Status System"
End Sub