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 » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Sum based on subforms



 
 
Thread Tools Display Modes
  #1  
Old December 11th, 2009, 07:17 PM posted to microsoft.public.access.tablesdbdesign
f123 via AccessMonster.com
external usenet poster
 
Posts: 10
Default Sum based on subforms

i have a main form containing two subforms (Activity&ActivityContest), where
its a One to Many relationship between Activity&ActivityContest.
Example:
Activity
ID ActivityBudegt
1 1000
2 500

ActivityConstist
ID ActivityID ActivityContistBudget
1 1 700
2 1 300
3 2 500
....

the question is,ActivityBusget is the total sum of ActivityContistBudget for
each ActivityID
i tried many ways but doesnt work with me

any help appreciated

--
Message posted via http://www.accessmonster.com

  #2  
Old December 11th, 2009, 08:42 PM posted to microsoft.public.access.tablesdbdesign
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Sum based on subforms

You main form needs a totals query to sum the data from the table that has
the data shown in the subform.
--
Build a little, test a little.


"f123 via AccessMonster.com" wrote:

i have a main form containing two subforms (Activity&ActivityContest), where
its a One to Many relationship between Activity&ActivityContest.
Example:
Activity
ID ActivityBudegt
1 1000
2 500

ActivityConstist
ID ActivityID ActivityContistBudget
1 1 700
2 1 300
3 2 500
....

the question is,ActivityBusget is the total sum of ActivityContistBudget for
each ActivityID
i tried many ways but doesnt work with me

any help appreciated

--
Message posted via http://www.accessmonster.com

.

  #3  
Old December 12th, 2009, 07:17 AM posted to microsoft.public.access.tablesdbdesign
f123 via AccessMonster.com
external usenet poster
 
Posts: 10
Default Sum based on subforms

appreciate your feedback DEWEY, but i didnot figure out what you mean!!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...esign/200912/1

  #4  
Old December 12th, 2009, 08:46 PM posted to microsoft.public.access.tablesdbdesign
Bob H[_4_]
external usenet poster
 
Posts: 161
Default Sum based on subforms

You need to build or create a query based on the information in your
table, and then in design mode click the 'Totals' button and group the
feild you want to total by 'sum'.

f123 via AccessMonster.com wrote:
appreciate your feedback DEWEY, but i didnot figure out what you mean!!

  #5  
Old December 12th, 2009, 08:46 PM posted to microsoft.public.access.tablesdbdesign
Bob H[_4_]
external usenet poster
 
Posts: 161
Default Sum based on subforms

You need to build or create a query based on the information in your
table, and then in design mode click the 'Totals' button and group the
feild you want to total by 'sum'.

f123 via AccessMonster.com wrote:
appreciate your feedback DEWEY, but i didnot figure out what you mean!!

  #6  
Old December 15th, 2009, 10:28 AM posted to microsoft.public.access.tablesdbdesign
rolaaus[_2_]
external usenet poster
 
Posts: 16
Default Sum based on subforms

I'm completely willing to admit if I'm wrong, but if f123 did what you
suggested (Bob and Karl), wouldn't it make the main form un-editable?

f123, if you're up to it, I would recommend using an unbound field, and
write a VBA module that updates the unbound field with the total. For one
thing, your total shouldn't be editable, which means you can change the
editable property of that field to false.

The VBA module would look something like
dim rsRecord as currentdb.openrecordset("Select sum(calculatedFieldName)
from SomeTable WHERE KeyValue = " & me.KeyFieldName

me.txtCalculatedValue.text = rsRecord("CalculatedFieldName")

(some minor tweaking required, but this gives you a start)

This module would go in the OnCurrent event procedure.

"Bob H" wrote:

You need to build or create a query based on the information in your
table, and then in design mode click the 'Totals' button and group the
feild you want to total by 'sum'.

f123 via AccessMonster.com wrote:
appreciate your feedback DEWEY, but i didnot figure out what you mean!!

.

 




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 06:33 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.