ACC: How to Recover a Table Deleted from a DatabaseID: Q179161 
  | 
Moderate: Requires basic macro, coding, and interoperability skills.
This article shows you how to create a sample Visual Basic for Applications
function that you can use to recover a table deleted from a Microsoft Access for Windows 95 and Microsoft Access 97 database under the following conditions:
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.asp
The following sample function recovers the last table deleted within a
Microsoft Access database. To create the sample function, follow these
steps.
NOTE: These steps assume that you are creating the sample function for
future use. If instead you are adding the code directly to a database in
which a table has recently been deleted, skip step 1, because if you have
closed Microsoft Access or the database, the deleted table is not
recoverable.
    Function undo()
      Dim db As Database, strTablename As String
      Dim i As Integer, StrSqlString As String
      Set db = CurrentDb()
      For i = 0 To db.TableDefs.Count - 1
      If Left(db.TableDefs(i).Name, 4) = "~tmp" Then
         strTablename = db.TableDefs(i).Name
         StrSqlString = "SELECT DISTINCTROW [" & strTablename & _
           "].* INTO MyUndeletedTable FROM [" & strTablename & "];"
         DoCmd.SetWarnings False
         DoCmd.RunSQL StrSqlString
         DoCmd.SetWarnings True
         MsgBox "A table has been restored as MyUndeletedTable", _
           vbOKOnly,"Restored"
         GoTo Exit_undo
      End If
      Next i
      MsgBox "No Recoverable Tables Found", vbOKOnly, "Not Found"
      Exit_undo:
         Set db = Nothing
         Exit Function
      Err_undo:
         MsgBox Err.Description
         Resume Exit_undo
    End Function 
?Undo() For more information about TableDefs, search the Help Index for "Tabledef Object."
Additional query words: Restore Delete Recover
Keywords          : PgmHowto 
Version           : WINDOWS:7.0,97
Platform          : WINDOWS 
Issue type        : kbhowto 
Last Reviewed: July 6, 1999