Solved

# Sum the column in a subdatasheet.

Posted on 2004-11-05
999 Views
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
Question by:Basicfarmer

LVL 8

Expert Comment

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

LVL 1

Accepted Solution

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…