by Esmael Telmosa (7 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Fri 16th June 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Restore database(for Ms Access only)
API Declarations
Dim CommondialogControl As Control
'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