Need to Generate a calculated Field in Default Value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am needing to modify a form so when values are entered in a text box,
certain calculations take place.... Example: when 100 is entered in box "A"
the following chain of events happens (either automatically, or by pressing a
button): box "B" multiplies the sum in box "A" by .25 and sets that value in
box "B" to 25. Also Box "C" multiplies the value of box "B" by 0.5 so we end
up with 12.5 in box "C" .....however, I need the ability to override these
calculations. This is why I think that placing the calculations in the
"default value" section is most appropriate.... Thank You
 
You are correct, but placing them in the default will not cause the
calculation to occur after filling in box A. The defaults will be
established when you start adding the record. You would need code in the
OnChange event of FieldA. Your code would say something like...

If FieldB="" then
FieldB = FieldA * .25
End If
If FieldC = "" then
Field C = FieldB * .5
End If




Hope that helps,

Rick B
 
In hindsite, If FieldB = "" might not work since it is not a text
field.

You might need to try...

If IsNull([FieldB]) then...



Rick B
 
Back
Top