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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undo a change in a combobox 1

Status
Not open for further replies.

raymondo

Technical User
May 3, 2002
86
0
0
AU
I'm using Access 2000 and I have a combobox containing a 2 column list - col1 is a code which is the column bound to the combobox and col2 is just a description. The combobox itself is bound to a field in a table via a query.
There are only three rows in this combobox so it's set up in the combobox properties.
The users can change the contents of the table at any time simply by selecting a different element from the combobox.
However, such a change can have serious consequences so I've set up a Before Update event that asks the users if they really want to select another value. If they say yes then the appropriate action is taken.
My problem is that if they say no I would like the value that was originally selected to be restored.
I've tried
Me![myCombo].Undo
Me![myCombo] = myOriginalValue
Me![myCombo].Value = myOriginalValue
None of the above 3 seem to work. In fact the second two each generate a runtime error.
Any suggestions would be appreciated. Raymondo
raymondo@rossar.net
 
if they say no then just set cancel=true.

Cancel is the variable that is passed in the beforeUpdate event.

HTH!

-Brad
 
Well, that got me part of the way in as much as it doesn't trigger the After Update event. However, the newly selected value is left in the combobox on the form and the user has to select the original value so that the Before Update event does get triggered again. Raymondo
raymondo@rossar.net
 
OK solved. Put undo AND set cancel to false.
Thanks Brad Raymondo
raymondo@rossar.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top