Connecting Tech Pros Worldwide Help | Site Map

how do i sum up the values of a field?

  #1  
Old November 25th, 2008, 04:20 AM
Newbie
 
Join Date: Nov 2008
Posts: 13
I have a table with a number of fields and many records and I need to sum up the values of cells of a column that meets certain criteria (eg. column1=column2, iif(column3=0)) and then sum it up to become a value under a new column in a new table.

I need to make a number of these new summation values to make up a new table of two rows and a number of columns (depending on the number of summed values i need)

How do i do this with VBA code? or any other method (but i need this to be run when one clicks on a button on a form)

Thank you!!
  #2  
Old November 25th, 2008, 07:28 AM
Expert
 
Join Date: Jan 2008
Posts: 365

re: how do i sum up the values of a field?


Hello again Kwokv616,

Once again, what you're describing is what can all be done in a query.

Once thing to keep in mind, with MS Access, it is very BAD programming practice to sum values from one table and added them to another table for review.. The problem inevitably is that some of the data will change, and you will have to go back and re-sum all the value again.

The way that we get around this is to simply base a form on a query that will display the calculated information the way that you would like. Then you can start to base forms and reports on this query.

So the query would look something like this:

Expand|Select|Wrap|Line Numbers
  1. SELECT Sum(Column1) FROM TableName WHERE Column1 = Column2 or Column3 = 0
  2.  
This doesn't require any VBA coding at all. this can be done in the query builder that comes with MS Access.

If you need more detailed help, let me know, and I would be more than happy to help.

Joe P.
  #3  
Old November 25th, 2008, 08:01 AM
Newbie
 
Join Date: Nov 2008
Posts: 13

re: how do i sum up the values of a field?


My required endproduct is:
A summed value in another table under a new column

Which means after summing up the values using your given SQL to give one new value, i would need it to display this new value under another column name.

How do I do this?

Thanks alot =)
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add all values of a specific variable using do-while and Javascript? shiloh answers 2 May 1st, 2007 12:25 PM
SUM of a text box in Access Reports philip260@gmail.com answers 2 January 11th, 2007 01:45 PM
Cumulative Sum in query is very slow... cefrancke@yahoo.com answers 4 November 13th, 2005 10:07 AM
HOW DO I ADD a vertical row of values in Access 2000?? amian answers 3 November 12th, 2005 08:18 PM