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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Command Button Enabled/Disabled 5
undo changes 2
Can't undo? 3
get out of control 5
Suppress MsgBox 7
Escape to undo form update 7
Undo Button 2
Autonumber increased event if the new record is not added 2

Back
Top