Sum the column in a subdatasheet.

I have a subdatasheet in a form. It is  for parts used on an invoice.

Qty    PN     Desc      Unit cost      Amount     Discount      Total

Amount is = [Qty]*[Unit Cost]

Total is = [Amount]*[Discount]

There may be 5 or so parts that are used on an invoice.

So there would be 5 values in the total column.

How do I get the sum of these totals no matter how many rows there are?

Any help would be greatly appreciated...

Thanks...
BasicfarmerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SashPCommented:
On the sub datasheet footer create a control with the formula

=Sum([Qty]*[Unit Cost])

and another with the formula

= Sum([Amount]*[Discount])

Placing the control in the footer section will sum all the records in the detail section
0
Y2Chris75Commented:
SashP is showing you how to calculate the info you need (needs to be in the footer), but I don't think the footer can be visible on a datasheet form.  So do your calculations that way .... then the next step would be to carry the info out to your main form.

Using the two samples above from SashP, lets say you created them and their names are "YourSumAmount" and "YourSumTotal".....

...now create a new control on your "main" form with the following:
=[Form].[YourSubformName]![YourSumAmount]
and
=[Form].[YourSubformName]![YourSumTotal]

This will give you the values from the subform footer in some controls on your mainform (so you can move them around) ... or use to code to update other fields on the main form or whatever else you might want.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.