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

Text boxes control source = calculation can't save sum

Status
Not open for further replies.

Patentinv

Technical User
Aug 26, 2005
84
US
Hello,
I've got a text box on my form header with a calculation in the control source that adds values from other text boxes on my form.
My problem is that since the calculation is in the control source of my text box I can not save the sum of the calculation to a field on the forms bound table.
Is there a way to move this calculation out of the control source and still have the calculation populate this text box with the sum of the calculation, so I can choice a field in which to save this calculations sum.

Calculation in the text box control source=
[Tot40yrcomp]+[Totfelt1536]+[Totfelt3036]+ there will be many more other text boxes added.

Thanks--Any help will be greatly appreciated.
 
In the BeforeUpdate event procedure of the form you may populate the bound control with the value of your calculation control.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Assuming your users are entering values into the text boxes [Tot40yrcomp], [Totfelt1536] etc you could try adding some code to the After Update event of each text box:

Me.txtTotal.Value = Me.Tot40yrcomp.Value + Me.Totfelt1536.Value Etc....

In this way the total value of any saved record should be modified if any of the other values are modified.

Alternatively don't bind the Totals text box to the table? - Just add the values and display the total in all forms, reports etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top