Solved

When creating a table in MS Access 2007. How do I sum a series of detailed records and assign it a field holder (store the sum) in an Access form?

Posted on 2010-09-17
6
376 Views
Last Modified: 2013-11-28
I have a simple detail table that takes a series of suppliers that send us a commodity and the columns need to be summed.
                                                    Suppliers       Weights

                                                     ACME            1000 lbs
                                                     ABC Co         1200 lbs
                                                     XYZ Co          1150 lbs
                     I need the count of suppliers and total weights summary below
                                                         3                3350 lbs

I think I need to create a field for each summary ten some how build the formula or expression that will add those up. Is that right and do you have an example in steps of how to do that?
0
Comment
Question by:ruavol2
6 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 300 total points
ID: 33706273
no field, you should never created fields you build on calculations

sql (queries) can handle this

count returns count of rows
sum returns total

eg create a query

select count(*) as TotalSuppliers, SUM(Weights) AS TotalWeights
from mytable

if unfamilair with queries you can do this in design view also
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 100 total points
ID: 33706277
a single query will do this.

SELECT COUNT(Suppliers) as CountOfSuppliers, SUM(Weights) as SumOfWeights
FROM yourTable

To do this from the query grid, drag the suppliers and weights fields into the grid.  Then click the "Totals" button in the Query Design ribbon, and change the Total Row in the query grid to Count and Sum (as appropriate).
0
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 300 total points
ID: 33706293
non programmatic way

open up new query, go to design, select your table and fields you want (suppliers and weights)

below on the field, right click and select totals

in the totals row select COUNT on the suppliers and SUM on the weights

then run your query. The sql generated should look something like what I posted
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 3

Assisted Solution

by:AccessYourBiz_Com
AccessYourBiz_Com earned 100 total points
ID: 33713046
The easiest way to do this is to create a totals row within a datasheet veiw form. To learn how to do that you can google
"Access 2007 add total row" or just follow this link.
http://www.ehow.com/how_2125021_use-access-2007-aggregate-functions.html
 
0
 

Author Closing Comment

by:ruavol2
ID: 33828316
Sorry I forgot to get back to this one. Great stuff my appologies for the late rewards.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33828360
No worries and thanks :)
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
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…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question