I have a combo box, so a user can change a selection. When this happens I need to write a history record on what the previous value was.
I have a hidden field which I populate whenever the control gets focus, then in the 'on change' event I compare with this hidden value. If its different, I write the history record. Is there a better way?
The change fires when a combo is updated, but also on each keystroke (and then the contents can only be read thru the .Text property, as stated above). Perhaps the After update is better?
Your method should do the trick (but again, perhaps on the after update of the control - or the before update of the form?)
To gain the old value from a control, you might also try using:
[tt]if me!mycombo.oldvalue<>me!mycombo.value then
' it's changed, and the oldvalue
' property holds the old value
end if[/tt]
I'm assuming you have tried the after update, and that it failed on your setup.
This works on my setup, and I'm lead to believe that the after update of a control is supposed to fire regardless of whether it's bound or not. Might there perhaps be something wrong on your setup? Perhaps some corruption issues?
But I don't think the oldvalue property is available on unbound controls.
You could perhaps use the on got focus event to drop the existing combo value to the other textbox (or use a public variable) then use the after update to compare those.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.