"Vmusic" <ak*****@irisicom.netwrote in
news:11*********************@75g2000cwc.googlegrou ps.com:
When the user changes or selects a different value than what is
initially displayed - the BeforeUpdate or AfterUpdate method
fires.
I want to prompt the user to confirm they REALLY want to change
their value - If they don't confirm - or say no, then I want to
change the value back to what it originally was. In order to
change the value back - I have to programattically change the
ListIndex or some stupid property in the combo box.
How do you use VBA to programmatically change which row in the
combo box is selected??
As long as the focus remains on the control, and the combo box is
bound to a field, you have access to the OldValue property.
Otherwise (unbound combo boxes are not uncommon, though there'd be
no reason to confirm a change, seems to me), you could cache the
original value in a variable in the OnEnter event of the combo box,
and use that to change it back.
But to select a row, you have two choices:
1. set the value (the sensible way), OR
2. set it by listindex (this is convenient when you want to
automatically select, say, the first entry in the dropdown).
To do it the second way, you'd have to know which row in the list
had the value you wanted. Obviously, it makes much more sense to
just store the value and restore to that.
Which is basically what you were told, even if you didn't like the
answer.
BTW, I was tempted not to bother to answer because you were so
damned rude in your responses to the help you were given. Had you
simply described your task in full, you could have had a good answer
a long time ago.
--
David W. Fenton
http://www.dfenton.com/
usenet at dfenton dot com
http://www.dfenton.com/DFA/