Combo No Change and After Update Event

Y

Yvonne

I have a combo box where the After Update event of the combo box is
used to reset another control on the form to Null.

Sometimes a user will want to reconsider his/her choice in the combo
box and make a different selection from what was there before. This is
OK as it triggers the resetting of the other control to Null.

My problem is - sometimes the user will revisit the combo box and
explore the other possible selections in the combo but eventually
settles back on the original selection with the result that the After
Update event is triggered and the other control value is scrubbed,
which is what we don't want.

How do I overcome this and stop the After Update activating if the
selection is the same as before?

Yvonne
 
J

Jon Lewis

If you are talking about a previously saved record and the combo is bound
then you can compare the combo.OldValue and combo.Value in the After Update
event and only reset the other control if these values are different.

For an unsaved record then, if it's really necessary, whenever the combo is
updated you could try saving the value in a hidden unbound text box and you
could compare the text box value with the combo's. (Update the text box's
value in the combo's After Update but obviously AFTER you make the
comparison)...off the top of my head

HTH
 
Y

Yvonne

If you are talking about a previously saved record and the combo is bound
then you can compare the combo.OldValue and combo.Value in the After Update
event and only reset the other control if these values are different.


I've tried the following wording to make the comparison but can't get
it to work..

"" If Me.ReasonID = Me.CmbReason Then...""

.... where CmbReason is the Combo box name and Reason ID is the Control
Source.

Any assistance would be much appreciated.
Yvone
 
Y

Yvonne

Any assistance would be much appreciated.
Yvonne

No worry, I just got it sussed by discovering the ".OldValue"
property.

Which all proves that Newbies learn something every every day.

Meantime , many thanks for pointing me in the right direction.

Yvonne
 

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

Top