A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

SUM Calculation in Mainform from data in Subform



 
 
Thread Tools Display Modes
  #1  
Old December 28th, 2006, 04:09 PM posted to microsoft.public.access.forms
rattler0812
external usenet poster
 
Posts: 19
Default SUM Calculation in Mainform from data in Subform

I have a form where the sum of a particular datasheet view field must be
shown. Essentially it is a time tracking form where each step is recorded in
the amount of time allotted and used. Both are seperate fields in the
subform. The main form has three boxes for the information based on the
calculations that need to be incorporated into the table for later queries
and data analysis.

Subform.Field1 and Subform.Field2 both need a SUM calculation made and
displayed in Mainform.Field1 and Mainform.Field2, respectively.
Mainform.Field3 is the variation in the two (allotted vs. actual). All three
Mainform Fields must be able to go into a table (again, for later use in
queries and data analysis).

Is there any way that this can be accomplished. So far I have had no luck
in getting the data to save to the table associated with the Mainform.

Rattler0812

  #2  
Old December 28th, 2006, 05:28 PM posted to microsoft.public.access.forms
Al Campagna
external usenet poster
 
Posts: 421
Default SUM Calculation in Mainform from data in Subform

Rattler,
Given that you have captured all the data needed to make the subform calculations (1,
2, and 3) in the subform, you would NOT want to save those values in table.
Never save values that can be derived from data you already have saved.

As an simple example... if you captured Price and Qty, you would not save the LineTotal
for that transaction (LineTotal = Price * Qty)... only "display" the calculated value, as
needed.

These "calculated" values can always be re-derived "on the fly", from the existing
table values, in any subsequent form, query, or report.

If you must "save" the 3 calc'ed values, you'll have to create table fields to retain
those values in your subform table.
Using my simple example above, with a table field named [LineTotal], On the AfterUpdate
of either Price OR Qty...
LineTotal = Price * Qty
In each of your 3 calcs, do the same in the AfterUpdate of any "element" involved in
that calculation.
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


"rattler0812" wrote in message
...
I have a form where the sum of a particular datasheet view field must be
shown. Essentially it is a time tracking form where each step is recorded in
the amount of time allotted and used. Both are seperate fields in the
subform. The main form has three boxes for the information based on the
calculations that need to be incorporated into the table for later queries
and data analysis.

Subform.Field1 and Subform.Field2 both need a SUM calculation made and
displayed in Mainform.Field1 and Mainform.Field2, respectively.
Mainform.Field3 is the variation in the two (allotted vs. actual). All three
Mainform Fields must be able to go into a table (again, for later use in
queries and data analysis).

Is there any way that this can be accomplished. So far I have had no luck
in getting the data to save to the table associated with the Mainform.

Rattler0812



  #3  
Old December 28th, 2006, 09:52 PM posted to microsoft.public.access.forms
rattler0812
external usenet poster
 
Posts: 19
Default SUM Calculation in Mainform from data in Subform

THANK YOU SO MUCH!!! While I understand your counsel to not save the data to
a table, it was not my decision to add that in. But, that is what I was
looking for so that my boss will be happy. Thank you again.

Rattler

"Al Campagna" wrote:

Rattler,
Given that you have captured all the data needed to make the subform calculations (1,
2, and 3) in the subform, you would NOT want to save those values in table.
Never save values that can be derived from data you already have saved.

As an simple example... if you captured Price and Qty, you would not save the LineTotal
for that transaction (LineTotal = Price * Qty)... only "display" the calculated value, as
needed.

These "calculated" values can always be re-derived "on the fly", from the existing
table values, in any subsequent form, query, or report.

If you must "save" the 3 calc'ed values, you'll have to create table fields to retain
those values in your subform table.
Using my simple example above, with a table field named [LineTotal], On the AfterUpdate
of either Price OR Qty...
LineTotal = Price * Qty
In each of your 3 calcs, do the same in the AfterUpdate of any "element" involved in
that calculation.
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


"rattler0812" wrote in message
...
I have a form where the sum of a particular datasheet view field must be
shown. Essentially it is a time tracking form where each step is recorded in
the amount of time allotted and used. Both are seperate fields in the
subform. The main form has three boxes for the information based on the
calculations that need to be incorporated into the table for later queries
and data analysis.

Subform.Field1 and Subform.Field2 both need a SUM calculation made and
displayed in Mainform.Field1 and Mainform.Field2, respectively.
Mainform.Field3 is the variation in the two (allotted vs. actual). All three
Mainform Fields must be able to go into a table (again, for later use in
queries and data analysis).

Is there any way that this can be accomplished. So far I have had no luck
in getting the data to save to the table associated with the Mainform.

Rattler0812




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:02 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.