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

Totaling columns on subforms

Status
Not open for further replies.

alley

Programmer
Feb 8, 2000
51
US
What is the procedure to total columns in&nbsp;&nbsp;subform records?&nbsp;&nbsp;The records are filtered by the main form, so only the records I need are in the subforms.&nbsp;&nbsp;A column in the 2nd subform&nbsp;&nbsp;must be updated with the total derived from the 1st subform and then totalled also.&nbsp;&nbsp;Hopefully, the resultant mods to the 2nd subform data will be updated in their table automatically upon exit of the main form record.<br><br>What I need is the commands to total the subform and commands to insert data to each record of a subform.&nbsp;&nbsp;The books I have do not enter this area at all.<br><br>Thanks
 
In the footer of the subforms create a textbox name it subtotal put in =sum([somefield]) hide the footer if you want.<br>now refer to that field on the main form =me.subform.[subtotal]or the other subform =forms.subfrom.[subtotal]<br><br>As DougP so often points out if you use the builder it will label these with the proper syntax for you.<br>there are also examples of this in the access database<br>
 
Thanks glo4.&nbsp;&nbsp;The solution to total the 1st subform is just the same as in a report, which I have done.&nbsp;&nbsp;<br><br>The second part (inserting the first total in all the records of the 2nd subform) is the tricky part, since each record must be updated.&nbsp;&nbsp;How do you do that?
 
Glo4 seems to me to be pointing out the right solution, adjusted for your specific circumstance.<br><br>Alternatively, consider that your forms are based on a query or table, so you know what will be shown. You could make another query to make a total of whatever you want, either a select query that you can &quot;dlookup&quot; to show on your form, or an update or append query if you want to put the total into a table somwhere.<br><br>HTH<br>Riny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top