Author : Esmael Telmosa
Date Submitted : 6/16/2006
Category : Database
Compatibility : .NET
This code has been accessed 7246 times.
Task : Restore database(for Ms Access only)
Declarations
Code
Sub RestoreDbase(CommondialogControl, StrSource As String)
'Ask the filename of Back-Up
CommondialogControl.Filter = "Back-Up Files(*.mdb)|*.mdb"
'Set a deafault DIR
CommondialogControl.InitDir = "C:\"
'Display the Open Dialog Window
CommondialogControl.ShowOpen
On Error GoTo Opps
'if there is a filename selected
If CommondialogControl.FileName <> "" Then
'overwrites the existing Back-Up Files w/ the Copied One
'''''''''Overwrites strSource with CommondialogControl.Filename
FileCopy CommondialogControl.FileName, StrSource
'display the path and filename of database
'Text1.Text = CommondialogControl.FileName
'prompt to user that Restoration is successful...
MsgBox "Restore Complete!", vbInformation, "RESTORE SUCCESSFUL"
End If
Exit Sub
Opps:
MsgBox Err.Description, vbExclamation, " "
End Sub