By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,665 Members | 1,513 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,665 IT Pros & Developers. It's quick & easy.

Comparing Original Value to New Value in the same textbox.

P: n/a
I have a bound textbox called txtMyBox with the current string value
of "200".
Once the user enters the textbox, and while the user is still in the
textbox, I would like to check the changed value using a function to
see if this changed value exists in a table. If it does, I want do
give a Msgbox Warning and restore the original value.

I thought that I would require the OnUpdate property of the textbox to
do this, but I can't seem t
to compare the original value to a newly entered value. Am I in the
wrong property???

Thanks Greg

Jan 28 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Sorry

Meant to say BeforeUpdate property!
>thought that I would require the OnUpdate property of the textbox
to
>do this, but I can't seem t
to compare the original value to a newly entered value. Am I in the
wrong property???
Greg
Jan 28 '07 #2

P: n/a
My Solution required the AfterUpdate Event

Had to assigned value to a Public Variable outside the AfterUpdate
event
strPubVar = Nz(Me.txtMyBox, "")

Then in the AfterUpdate Event of txtMyBox placed my duplicate
function:
If Duplicate Then
Me.txtMyBox = IIf(Len(strPubVar) = 0, Null, strPubVar)
End If
Jan 28 '07 #3

P: n/a
Ap******@gmail.com wrote:
I have a bound textbox called txtMyBox with the current string value
of "200".
Once the user enters the textbox, and while the user is still in the
textbox, I would like to check the changed value using a function to
see if this changed value exists in a table. If it does, I want do
give a Msgbox Warning and restore the original value.

I thought that I would require the OnUpdate property of the textbox to
do this, but I can't seem t
to compare the original value to a newly entered value. Am I in the
wrong property???
I believe the .OldValue property of the textbox will hold the original value and the
..Value property will hold the updated value. The .Text property may also be of interest.

..BeforeUpdate would seem to be the event to use. Haven't tested this but should be easy
enough for you to experiment with.

--
'---------------
'John Mishefske
'---------------
Jan 29 '07 #4

P: n/a
John

I am using Access2K, and do not see the .OldValue property of the
textbox.
This must have been a latter improvement?

Thanks Greg

Jan 30 '07 #5

P: n/a
<Ap******@gmail.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
John

I am using Access2K, and do not see the .OldValue property of the
textbox.
This must have been a latter improvement?
There is no property box for it as it is only available in code. All versions
have it.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jan 30 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.