Recall the previous value of a record on form

Gaccesses

Registered User.
Local time
Today, 09:45
Joined
Mar 13, 2012
Messages
40
HI All,

I hope you can help, because I am going cross eyed. I have been working on this for one week.:banghead:

I am creating a form that will be used for editing existing records.

When a particular record comes up on the form; I would like the value of one textbox within the record to be saved into a unbound and hidden textbox, which is located on the same form. The value placed in the unbound and hidden textbox would be the old value of the record.

I am doing this because I will be creating a program to compare the old value against the new value inserted by the user.

For instance:

Form
Car - Nissan
VIN- ioujoiajifja
Value - 20,000

Edited Form
Car - Nissan
VIN- ioujoiajifja
Value - 25,000
hiddenbox- 20,000


value has increased by 5,000.
 
Bound controls have an OldValue property. That might be all you need.

What do you want to do with this old value?


(But anyway, to do exactly what you ask just assign the hiddenbox the value of the field in the form's current event:

Code:
Private Sub Form_Current()
     Me.hiddenbox = Me.[Value]
End Sub

If you really have a field called Value I think you should change that name. It could cause a lot of confusion to people reading your code as well as to Access itself to use that name.)
 
I want to use the value that will be located in the hidden box to do many comparison parameters as well as state the difference in the values.

@VilaRestal When you mention "OLD VALUE" property.. how do I use this?
 
Assuming your field is still called [Value] then its old value (before it was modified) is:

Me.[Value].OldValue

I only say it may be all you need because it gets overwritten when the record is saved. So if you want to keep the Old Value even after it's saved then you do need to store it somewhere.
 
This worked, buddy. Thank you so much. Turns out with the .oldvalue property listed after the expression, I really do not need to store anything !! Eyes are uncrossed and this dilemma is solved :)
 

Users who are viewing this thread

Back
Top Bottom