[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1241
  • Last Modified:

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...
0
Basicfarmer
Asked:
Basicfarmer
1 Solution
 
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

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now