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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

saving calculated field into table

Status
Not open for further replies.

MykH

Technical User
Sep 18, 2001
8
0
0
US
newbie question again :)

can anyone describe (including code Thx) the easiest method of saving results from a calculated text box..? I'v eread several posts regarding the subject, but just can't get it to work. To describe my for, I have a text box that totals entries from other text boxes. The calculated(txtTotal) box is bound to the following:

=txtBox1 = txtBox2 = txtBox3, etc.

I'd like the calculated box to then save the results to a recordset in my table. Any suggestions would be GREALY appreciated :)

Thx
 
Calculated values should NEVER be stored in a table (redundancy, waste of space, necessity to update them whenever a compound value changes...)
Why do you want to store them?

Dan
[pipe]
 
Well my project started with creating a customer survey which accepts user input that's weighted. I made the mistake of creating a bound form (newbie), on this form i have the fields that are weighted totaled into a caculated text box. I'd like to save the results from the text box to the database. Any ideas..?
 
Suppose your calculated textbox has the formula:
=YourFormula
Open the form in design view
Go to View-Code
Paste this (and make the necessary adjustments:

Sub Form_BeforeUpdate(Cancel As Integer)
Me("YourBoundControl") = YourFormula
End Sub

Note: YourBoundControl is the name of the text box on the form that is bound to the field where you want to store the result.

However, I would strongly recommend that you always retrieve calculated results by calculating them, not by storing redundant data.

Regards,

Dan
[pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top