automatically update field on subform with main forms changed data

Davros

Registered User.
Local time
Today, 14:00
Joined
Sep 9, 2005
Messages
131
hi guys
i have a main form and a subform. on the main form i have a field called 'category' [numerical] and on the sub form i have a field called 'old_category' [numerical]
what i want to do is if i change the 'category' field from 1 to 2 i automatically want the old value of 1 stored in the sub form 'old_category' field.
any ideas?

thanks
 
What's happening in the background between you entering a new value and it displaying the old value? Is it being entered in to a table or are you using a query of some sort?

Is nothing happening, do you want it to just display it and then work with it later?
 
thanks for the reply
the answer was to look up the '.value' and '.oldvalue' actions and code my text box so that the afterupdate event of the 'category' field was to place the old value in the text box of the 'old category' field.

Me.[old category].Value = Me.Category.OldValue
 
I think you're going to have to store the new value in a variable that keeps it's value between events, and possibly between shutting the computer down and starting it up the next day?

Not sure, but would the only way to do this be to store it in a table?

You could get the onupdate event to write the new value to this 'LookUpTable', after getting the old value from it.

This way when the 'catagory' field is updated with the new value, what's in the table would be the old value which could be sent to the 'oldcategory' text box. AFTER it's done this, update the LookUpTable with the value in the 'category' text box. The value in the 'category' text box and the LookUpTable would now be the same untill the text box is next updated, when the value in the table would then be the old value..... and so on.

Not sure if it's the best way to do this. But if you want it to survive between shutdowns then I can't think of another way.

Hope that makes sense :confused:
 
thanks
the data is stored in a table but i did try what you suggested above and everthing was fine on the reboot
 

Users who are viewing this thread

Back
Top Bottom