Undo button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an Undo Record button in my form that is working weird. I created it
using the wizard. If I press it, it will either ask if I want to delete the
record, or it will undo changes I made on another record. What am I doing
wrong?
 
The wizard-generated undo button should not delete the record, but it can
undo another record.

The code below should not have that behavior:
Private Sub cmdUndo_Click()
If Me.Dirty Then
Me.Undo
Else
Beep
End If
End Sub

Note that an undo button on a form is of limited use. If you are in the
process of entering something invalid, Access won't let you out of the
current control until you fix that. Consequently you can't even get to the
undo button if the current entry is invalid (such as 1/1/ in a date field,
or backspacing all characters out of a required field.)
 
Your rountine will have your button name in place of cmdUndo.

1. Open your form in design view.

2. Right-click your command button, and choose Properties.

3. On the Event tab, set the On Click property to:
[Event Procedure]

4. Click the Build button (...) beside this.
Access opens the code window.
Set up the code as shown.
 
Ok, it seems to be working now. Thank you

Allen Browne said:
Your rountine will have your button name in place of cmdUndo.

1. Open your form in design view.

2. Right-click your command button, and choose Properties.

3. On the Event tab, set the On Click property to:
[Event Procedure]

4. Click the Build button (...) beside this.
Access opens the code window.
Set up the code as shown.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Annemarie said:
Do I substitute cmdUndo_Click() with the name of my button?
 
Back
Top