Connecting Tech Pros Worldwide Help | Site Map

how do i sum up the values of a field?

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 25th, 2008, 03:20 AM
Newbie
 
Join Date: Nov 2008
Posts: 13
Default how do i sum up the values of a field?

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!!
Reply
  #2  
Old November 25th, 2008, 06:28 AM
Expert
 
Join Date: Jan 2008
Age: 44
Posts: 365
Default

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.
Reply
  #3  
Old November 25th, 2008, 07:01 AM
Newbie
 
Join Date: Nov 2008
Posts: 13
Default

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
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.