Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undo issues...why is this not working?

Status
Not open for further replies.

btj

Technical User
Nov 17, 2001
94
US
In my code, I have a MsgBox that pops up after a field ("Category")has been changed. If the user didn't mean to change said field, then I have a Undo function.

This works fine, but I want the cursor to reselect the initial field. I cannot seem to get this to work. Additionally, I only want to undo that one field's change, but Undo seems to undo all actions.

Please let me know if you know how to undo the last action and if you know how to go back to the field that was just undone.

Thank you in advance.

- Ben
 
This is the beauty of the BeforeUpdate event. If I have a field named "city", the code would be as follows:

==========
Private Sub City_BeforeUpdate(Cancel As Integer)
If MsgBox("Are you sure you wanted to change this field?", vbYesNo + vbQuestion, " Continue?") = vbNo Then
Cancel = True
Me.Controls("City").Undo
End If
End Sub
========== Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Of course...thanks so much for the quick and much needed response.

-Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top