By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,308 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

undeleting records

P: n/a
Hi,

I understand that when a record is deleted it is still in the database but
just flagged as deleted.
Is there anyway to recover these deleted records? I am using Access 2000.
Any help in this would be greatly appreciated and Thanks in advance for any
help given.

Nathan Bloom
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Nathan Bloom" <na*******@earthlink.net> wrote in message
news:au*****************@newsread1.news.pas.earthl ink.net...
Hi,

I understand that when a record is deleted it is still in the database but
just flagged as deleted.
Is there anyway to recover these deleted records? I am using Access 2000.
Any help in this would be greatly appreciated and Thanks in advance for any help given.

Nathan Bloom


nope, not true. a deleted record is deleted...back up your database often!!
Nov 12 '05 #2

P: n/a
"Nathan Bloom" <na*******@earthlink.net> wrote in message news:<au*****************@newsread1.news.pas.earth link.net>...
Hi,

I understand that when a record is deleted it is still in the database but
just flagged as deleted.
Is there anyway to recover these deleted records? I am using Access 2000.
Any help in this would be greatly appreciated and Thanks in advance for any
help given.

Nathan Bloom


A nice way to handle this problem in the future is to implement a
tblUndo and a tblRedo. IdUndo is an Autonumber field. tblIDOsf is
the table that is bound to the subform. tblUndo, tblRedo and tblIDOsf
are local tables. Users really love to be able to Undo and Redo
changes. Plus it gives you a method to archive all changes made to a
linked table. This would be especially useful if changes are appended
to a database table that is separate from the server and the server
goes down. You could re-create all the changes made since the backup
was done. There are probably easier ways to do this. Here is some of
the code I have on a cmdUndo button:
....
Set MyDB = CurrentDb
strSQL = "SELECT * FROM tblUndo ORDER BY IdUndo;"
Set UndoRS = MyDB.OpenRecordset(strSQL, dbOpenDynaset)

If UndoRS.RecordCount > 0 Then
'Undo the last change then delete the tblUndo record
UndoRS.MoveLast
If IsNumeric(UndoRS("ItemIDIDOsf")) Then
'Go to the right record on the subform and change the values
strSQL = "SELECT * FROM tblIDOsf;"
Set MyRS = MyDB.OpenRecordset(strSQL, dbOpenDynaset)
If MyRS.RecordCount > 0 Then
MyRS.FindFirst "[ItemID] = " & UndoRS("ItemIDIDOsf")
If Not MyRS.NoMatch Then
SubformIDO.SourceObject = "frmSubIDOStatus"
'Allow for any fields to have changed at the same time
If Nz(UndoRS("OldDetNumber"), "") <>
Nz(UndoRS("NewDetNumber"), "") Then
MyRS.Edit
MyRS("DetNumber") = UndoRS("OldDetNumber")
MyRS.Update
End If
If Nz(UndoRS("OldQuantity"), 0) <> Nz(UndoRS("NewQuantity"),
0) Then
MyRS.Edit
MyRS("Quantity") = Nz(UndoRS("OldQuantity"), 0)
MyRS.Update
End If
'...
'Put the undo record in redo before deleting it
strSQL = "SELECT * FROM tblRedo ORDER BY IdRedo;"
Set RedoRS = MyDB.OpenRecordset(strSQL, dbOpenDynaset)
If RedoRS.RecordCount > 0 Then RedoRS.MoveLast
RedoRS.AddNew
RedoRS("ItemIDIDOsf") = UndoRS("ItemIDIDOsf")
RedoRS("OldOpAndTooling") = UndoRS("OldOpAndTooling")
RedoRS("NewOpAndTooling") = UndoRS("NewOpAndTooling")
'...
RedoRS.Update
RedoRS.Close
Set RedoRS = Nothing
UndoRS.Delete
'...

My code is actually a little more complicated because I keep track of
which fields get changed, which line on the subform the change
occurred and where to put the cursor when I get there.
'...
SubformIDO.SourceObject = "frmSubIDO"
SubformIDO.SetFocus
Set CloneRS = SubformIDO.Form.RecordsetClone
CloneRS.FindFirst "[ItemID] = " & UndoRS("ItemIDIDOsf")
SubformIDO.Form.Bookmark = CloneRS.Bookmark
CloneRS.Close
Set CloneRS = Nothing
'...
Note: This was done in Access 97 a while back. Newer versions of
Access may have better undo/redo features.

James A. Fortune
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.