Public Sub RestoreFromBackup()
Dim tbl As Variant
Dim intPos As Integer
Dim strNewName As String
For Each tbl In CurrentData.AllTables
intPos = InStr(1, tbl.Name, " Backup")
If intPos > 0 Then
strNewName = Left(tbl.Name, intPos - 1)
If MsgBox("Replace " & strNewName & " with " & tbl.Name _
& "?", vbYesNoCancel Or vbQuestion, _
"Rename Table") = vbYes Then
DoCmd.SetWarnings False
DoCmd.Rename strNewName, acTable, tbl.Name
DoCmd.SetWarnings True
End If
End If
Next
End Sub
|