-----Original Message-----
1. From the Database window, open the subform in design view.
2. If you do not see a Form Footer section, select Form Header/Footer from
the View menu.
3. Add a text box to the form footer, and give it these properties:
Control Source =Sum([Price]*[Quantity])
Name txtTotal
Format Currency
Save and close the subform.
4. Open the main form in design view. Add a text box with this Control
Source:
=[NameOfYourSubformControlHere].[Form]![txtTotal]
If you do not know the name of your subform control, right-click the edge of
it and choose Properties. The Name property is on the Other tab of the
Properties box.
Note that this approach displays the total on the main form, but does not
save it there. You should not save the total back into the main form's
table, as doing so breaks basic rules of normalization. More information:
http://allenbrowne.com/casu-14.html
If you have a good reason to save the calculated total back into the main
form's table, use the AfterUpdate and AfterDelConfirm events of the form in
the subform to DSum() all the related records directly from the subform's
table.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
I have a subform with fields Price, Quantity & Total
(among others). The "Total" field is autopopulated by
using =[Price]*[Quantity] as an expression in the Control
Source. Is it possible to autopopulate a text box on the
main form with a sum of the totals?
Thanks
Mark
.