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

Calculated field question

Status
Not open for further replies.

ajhull

IS-IT--Management
Aug 11, 2001
45
CA
I am having some problem trying to save a value in a calculated field to the database. Here is the information...

Database:
Field_A number
Field_B number
Field_C number

Form:
I have placed Field_A, Field_B, Field_C onto the form. I then opened the properties of Field_C and typed the following into Control Source: =[Field_A]+[Field_B]
When I type values into Field_A and Field_B, Field_C works as expected. The problem is when I close the form or enter a new record, the calculated value in Field_C on the form is not saved to the Field_C in the database.

I imagine this is something simple that I am not doing.

Help?

Adrian
Certified DBA/Developer
 
The only way to save the value to the underlying table is by using code. Normally, you don't save dynamic data to a table. Usually you just do the calculations when you need them but if you want to save it to the table then you would set the control source for FieldC to the Table field and in the afterupdate event of FieldB put

Me.FieldC = Me.FieldA + Me.FieldB

Then the value will be saved to the underlying table.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top