recover of deleted table possible?

  • Thread starter Thread starter Sascha Hendel
  • Start date Start date
S

Sascha Hendel

Hello,

accidently I deleted a table in my microsoft access 97
database. I noticed it instantly.
Is there a way to undelete/recover the table?
An answer would be very very helpful for me because I
spent more than two weeks work in this table and missed to
make a backup :-(

Sascha
 
The Undo command is available on the Edit Menu when you are editing a record
or, in VBA, when you are editing code. It is not available when you delete
an object.
 
Well in Access 97 I just deleted a table then went up to Edit and there was
Undo Delete, which I then pressed and hay presto the table reappeared, wow
 
Sascha Hendel said:
Hello,

accidently I deleted a table in my microsoft access 97
database. I noticed it instantly.
Is there a way to undelete/recover the table?
An answer would be very very helpful for me because I
spent more than two weeks work in this table and missed to
make a backup :-(

Sascha

If you haven't compacted the database, try the following function. I
can't remember if you can expect it to work if you've closed and
reopened the database or not, but it's worth a try:

----- start of code -----
Function UndeleteTable()

Dim db As DAO.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_UndeleteTable
End If
Next i
MsgBox "No Recoverable Tables Found", vbOKOnly, "Not Found"

Exit_UndeleteTable:
Set db = Nothing
Exit Function
Err_UndeleteTable:
MsgBox Err.Description
Resume Exit_UndeleteTable

End Function
----- end of code -----
 
hello again,

thanks for the fast answers. Unfortunately I already
closed the database and noticed the deletion too late.
No chance for an simple Undo anymore :-(
I contacted Peter Miller, an it seems that he's the master
of recovery. He'll undelete this ... table (and the cheque
for his service will help me to regularly backup my files
in future).

Sascha
 
Back
Top