Detecting change on a calculated field

M0E-lnx

Registered User.
Local time
Today, 10:36
Joined
Sep 3, 2008
Messages
62
I have a couple of fields in a form which are either calculated fields or get their values from another place(a subform).

I need a way to "sense" when the values of these boxes has changed (the user never changes these values)

Any idea?
 
anybody?... I've been trying to get this, I can't seem to wrap my brains around it
 
IIRC, none of the Change or Update events fire when a calculated control changes due to changes in other controls. I suspect you'll need to look for the values the calculation is based on changing.

I'm penalizing myself 10 points for overuse of the word "change". :p
 
Why exactly do you need to "sense" when they change? You cannot use the OnChange event; like the Before and After update events, it only fires if the data is physically entered/changed, not when it's done programatically.

My guess is you'll have to do whatever it is you want to do immediately after your code to calculate the value or the code to retrieve your value, i.e.

Me.TextboxC = Me.TextboxA + Me.TextboxB
'Execute your code based on this new value

Or you could put code in an event like TextboxC_AfterUpdate and call the event

Me.TextboxC = Me.TextboxA + Me.TextboxB
TextboxC_AfterUpdate
 
Indeed, I've tried using the after update and change events, but they dont seem to fire up unless data is physically entered.

I need these 2 fields compared if they both hold the same value, I'll trigger other things
 
going back to square 1

if your calculated figure is changing its because something (in its constituent parts) is making it change. so you need to look at either

a) the fields that drive this calculation or
b) the main form current event, or sub form current event, if its a calculation based on other records

and not the field itself - changing values of something with code doesnt fire the interactive events for theat something
 
Indeed, I've tried using the after update and change events, but they dont seem to fire up unless data is physically entered.

That's exactly what I said in my last post! That's why I said you'd have to trigger it by calling the event, such as

Me.TextboxC = Me.TextboxA + Me.TextboxB
TextboxC_AfterUpdate 'This calls the AfterUpdate function
 

Users who are viewing this thread

Back
Top Bottom