Thank you for your response. Your help was too late...
I have learnt a valuable lesson indeed, and I am making regular back-ups of the database I am currently working on.
I am a complete novice and I was just testing this method of recovery, incase I ever needed it in the future. I followed the instructions however, when I clicked Compile database name, under the Debug menu the following error message was displayed.
"Compile error:
User-defined type not defined"
This is the code was it is on the website:
Function Undo()
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_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
The bit that is highlighted when the error message is displayed is
db As DAO.Database
How can I fix this?
It is not important that you reply and if you chose not to, then thats no problem, but I am just interested to see if this works.
Thanks, Jim.