Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to perform a calculation in a form field??? 1

Status
Not open for further replies.

oquinnc

Technical User
Feb 27, 2001
38
US
I have a database built that has most of the functionaliy I
am needing. I am stuck on some calculations. I know that
the formulas are correct, as I have been using them in
Excel.

Here is my problem:
Field 1: default value is set to 5000.
Field 2: value is entered by the user.
Field 3: [Field 1] - [Field 2]

Field 3 does not calculate when a value is entered into
Field 2. The formula is entered into the "Default Value"
property using the expression builder.

Is this an update issue? How should I set the field to update?

Thanks!
 
try placing the calculation in the AfterUpdate Event of the TextBox conataining Field 2, so that the TextBox containing Field 3 is recalculated after a change is made, and reference the TextBox Controls instead of the Fields.

Private Sub TextBoxNameForField2_AfterUpdate()
TextBoxNameForField3 = TextBoxNameForField1 - TextBoxNameForField2End Sub

And if you might enter data into the TextBox containing Field 2 and then change the value in the TextBox containing Field 1, you should add the Code to the AfterUpdate Event for Both TextBoxes.

PaulF
 
Thanks Paul! I thought it was an update issue. Thanks for pointing me in the right direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top