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!

Sum up two existing fields and populate it into a 3rd existing field

Status
Not open for further replies.

lcutliffe

IS-IT--Management
Dec 1, 2006
30
0
0
US
HI
Im working on a form in an Access 2007 database where I have two seperate fields on the form that I would like to add together and enter it into a third box on the same form upon submit. The fields I would like to add together are [labor] and [material]. When the submit button is pushed on the form I need the total to be entered into the field called [totalcost] and saved. I've read about using a query to do this and I created one that sums up labor and material successfully but when it comes to placing the [totalcost] field on the form, i'm not sure how to proceed. So far all I get is an error.
 

If you base your form on the query, you will have a bound field that displays the total cost.
No need to save it. The query will always recalculate when you open your form.

Randy
 
I'm with Randy: Why storing calculated/derived values ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Mainly for reporting purposes. Lets say I plugged the data base into a crystal report and I had to drag over a table and wanted to report sums of this derived field, is it going to be there? Thats what I wasnt sure about. If the form calculates it on the fly then where is that calculation if the form isnt open and your trying to pull those numbers into a report. I guess this is my inexperience showing through.
 
Do the calculations in a query

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 

Just like the form, a report can (and should) be based on a query.

Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top