View Full Version : Don't know if it can be done.....


simongallop
12-20-2000, 08:01 AM
I am trying to find an easy way to see if data in a textbox has been changed when it loses focus.
1 Is there a compare command or;
2 Is there a way in which I can assign the contents to a variable and then check that variable against the 'new' contents or;
3 Will I have to dump the original data into a spare textbox/label using On Got Focus and then test it with On Lost Focus?

Any help appreciated

Thanks in advance

Simon

mike fds
12-20-2000, 09:49 AM
hi,
I think that if you move off a control and the data has changed, Before- and AfterUpdate fire whereas if the data hasn't changed, they don't. I think this works for unbound controls as well as bound ones but not sure
yours,
mike

Jack Cowley
12-20-2000, 09:56 AM
Search help for the OldValue property. You can do a comparison similar to this:

If Me![txtboxName].OldValue <> Me![txtboxName].Value Then
MsgBox "The Data has changed."
End if

BarkerD
12-20-2000, 11:13 AM
Doh! That is a much easier solution than I have employed.

I have always used the Current Event to store the value in a variable, and then compare it to the new value.

I'm going to try that.

simongallop
12-21-2000, 01:02 AM
Jack, thanks for the pointer, but what I forgot to say was that the textboxes are unbound. Mike, you are right that afterupdate works for unbound controls.

Thanks guys for replying and making my life easier!!

Merry Xmas etc.

Simon