Text and Value properties

J

Jess

I have a form with a few textboxes (textbox1, textbox2, etc.). This form is
based on an table.

Whenever textbox1 is updated the textbox1_beforeupdate event is triggered –I
trigger this event by browsing to the next record. In this event
Me.textbox1.text and me.textbox1.value show the same value, the one
me.textbox1.text has. I thought that the value property had the previous
saved value whereas the text property had the actual textbox content. This
does not seem to be my case.

I can retrieve the previously saved value by using the recordsetclone form
property. But I would like to use value textbox property.

Can anybody tell me why Me.textbox1.text and me.textbox1.value show the same
value in the the textbox1_beforeupdate event?

Thanks in advance
 
J

Jack Leach

I've used the Text value of a control many times before because the Value
isn't available. Though, most times I've done it this is on an unbound
control.

How are you going to the next record to trigger the event? The control's
BeforeUpdate will fire when the data is changed and focus is lost, so by the
time you are changing records this event should already be run and done.

You might try taking a look at the Form's BeforeUpdate rather than the
control's. In general, if I need to format (say capitalize) a word typed in
the textbox, I'll use the control's beforeupdate event, but if I need to
verify the data of a particular control I'll do it in the form's BeforeUpdate
event (which will fire on changing records or switching the focus to a
subform).

hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
J

jasonsadventure

JimBurke via AccessMonster.com said:
Value and Text will always show the same result as far as I know. You're
thinking of OldValue. I'm not sure how reliable the OldValue property is. I
tried using it long ago and couldn't get it to work right, but it's possible
I just didn't have a full understanding of how it works. If I want to keep
track of a field's old value I do it myself with variables that I update in
my code. Try using OldValue and see if it works. I personally never use the
Text property, because it requires the field to have focus, which can be a
real pain coding-wise. The default property for a textbox is Value, so I
always just refer to a textbox by it's name with no property.
 

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