Take a look at the DSum VBA function.
Or, if the subform is continuous, create the calculated control in the header or footer section with the Sum SQL aggregate function. Your main form may grab the calculated value with this syntax:
Me![subform control name].Form![calculated control name].Value
Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
Hi PHV,
I looked up the DSUM syntax and here is what it said to do:
DSum («expr», «domain», «criteria»)
I'm not sure how to do this...
My expr = addCharges.cost
domain = addCharges
And here is where I'm confused... My criteria is a pretty nasty join between 3 tables:
SELECT addCharges.cost
FROM scheduledSurgery INNER JOIN (addCharges INNER JOIN surgeryAddCharge ON addCharges.addChargeID=surgeryAddCharge.addChargeID) ON scheduledSurgery.surgeryID=surgeryAddCharge.surgeryID;
PHV,
Would you be interested in helping me finish this project? It's clearly over my head, and I'm under a time crunch...
I just have a few calculated control fields on a subform that are sums of child records. Should be easy to do. Also, I've got a report that I need help with getting it to break correctly and sum several total fields.
Please let me know if you are interested, and what your hourly rates are.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.