AccessBlog.net

News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Alex
Name:Alex Dybenko

Location:Moscow, Russia

Monday, September 26, 2005

How to undo whole record

This tip I learned from MVP Allen Browne
Here a code, which you can place into Undo button click event:

If Me.Dirty Then
Me.Undo
End If
If Not Me.NewRecord Then
RunCommand acCmdDeleteRecord
End If

8 Comments:

Anonymous Anonymous said...

Very useful, thanks. I was strugling with undo on a form with both bound and unbound controls and couldn't get the "DoCmd" to work properly. But this code does the trick.

5:56 PM  
Anonymous Anonymous said...

i was wondering if we can bypass the prompt for deletion

i mean, if there was no prompt before deleting the record, the undo operation would have looked more realistic :)

any thoughts?

12:51 PM  
Blogger Alex Dybenko said...

This comment has been removed by the author.

6:34 PM  
Blogger Alex Dybenko said...

Hi,
you can switch off delete prompts in access options

6:34 PM  
Anonymous Anonymous said...

ya that works :)

tools > options > Edit/Find > Confirm (Uncheck Record Changes option)


thanks for your "prompt" reply :)

7:39 PM  
Anonymous Anonymous said...

Or you could put in VBA:

DoCmd.SetWarnings (False)
...here comes your 'undo' code
DoCmd.SetWarnings (True)

_ _ _ _ _ _ _ _ _ _ _ _
this way you would have the warnings only temporarly inactive.

4:54 PM  
Anonymous Anonymous said...

Amazing!

5:59 PM  
Anonymous Anonymous said...

Anyone who knows where I can find a solution for this for Access 2010 Web (Macro style)?

11:17 AM  

Post a Comment

<< Home