calculated fields (1 Viewer)

Webmaster@worksnotfun.com

Registered User.
Local time
Today, 01:22
Joined
Jan 28, 2002
Messages
15
I no, you shouldn’t store calculated fields in a table, but rather on the
fly, but I need the data. I have a table w/3 fields tot_audits, TOT_DISCREP
& INFORMANCE (which is =1-([TOT_DISCREP]/[TOT_AUDITS]), but I can’t get it
to store in the table, from a form. I tried using the afterupdate event
Private Sub TOT_AUDITS_AfterUpdate()
Me.INCONFORMANCE = (1 - Me.TOT_DISCREP / TOT_AUDITS)
End Sub
But that doesn’t work Help
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 20:22
Joined
Feb 19, 2002
Messages
43,233
Your code should have done what you expected. However, that doesn't mean that it was "correct". It leaves a gaping hole for a data anomoly. What if someone updated TOT_DISCREP without updating TOT_AUDITS? The value of INCONFORMANCE should change but your code would never execute so INCONFORMANCE would not contain the correct value. What if someone updates either field in the table directly? The calculation would NOT take place and again the value of INCONFORMANCE would be incorrect.


Why do you think that you cannot calculate this value whenever you need it?
 

Users who are viewing this thread

Top Bottom