How do I use a text box's old value? (1 Viewer)

webmeister

Definitely certifiable
Local time
Today, 11:14
Joined
Apr 6, 2006
Messages
107
In a form I designed, the user can of course change the displayed value in a text box to a different value. However, what I want to be able to do is to use the text box's old value in some certain calculations, but end up with the text box containing the new value, which will also be used for some certain other calculations.

Is something like this possible, and if it is, how might I go about doing this?:confused:

Thank you....
 

KeithG

AWF VIP
Local time
Today, 09:14
Joined
Mar 23, 2006
Messages
2,592
Use the before update event to capture the textboxes value in a variable before the update takes place. Something like this in the forms before update event

strOldValue=me!"NameofTextBox.value
 

webmeister

Definitely certifiable
Local time
Today, 11:14
Joined
Apr 6, 2006
Messages
107
KeithG,

Thanks! That was certainly fast! I'll give your suggestion a shot. For the new value to be used in some other calculations, would I be correct in assuming I would use the after update function for the text box in question?

I certainly appreciate your help:)
 

KeithG

AWF VIP
Local time
Today, 09:14
Joined
Mar 23, 2006
Messages
2,592
Try this, make a new text box on your form and name it txtOldValue and change the visible property to false. Then on the field whose value you want to track go into the before update event and type the following.

me!txtOldValue=me!"NameOfTextBox"

Then in you calculations reference me!txtOldValue instead of the other textbox
 

webmeister

Definitely certifiable
Local time
Today, 11:14
Joined
Apr 6, 2006
Messages
107
And.....

thank you again for a quick reply!:D It got a bit hectic around here for a bit, but what I did was to put code against the "After update" portion of the text box similar to the code you just suggested, and it worked great. I will try your code also.

Again, I appreciate your taking the time to help those of us who are a little "Access-disadvantaged." :p
 

Users who are viewing this thread

Top Bottom