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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|