VBA code to sum highlighted

PhobiaBlu

New member
Local time
Today, 09:06
Joined
Jun 26, 2012
Messages
5
Working in Access 2003..
In a tbl or in a qry
I must sum or count the highlighted fields like in the attached clip (count=3 Sum=24) ..very easy in excel but in access no idea
1000 ths in advance

 
Hi PhobiaBlu,
Simplest way is to create a query. Since you didn't provide any table information on what you'll need to sum/count I'll create my own example.

Assume you have a table (tbl_YourTable) with 2 fields: Account_Number, Account_Balance,

To get a total count of the account numbers and their balance, you would simply create a Select query:
Code:
SELECT Count(tbl_YourTable.[ACCOUNT_NUMBER]) AS [CountOfACCOUNT_NUMBER], Sum(tbl_YourTable.[ACCOUNT_BALANCE]) AS [SumOfACCOUNT_BALANCE]
FROM tbl_YourTable;

In your table, if you're only looking to count/sum a particular type of account you'd need to add a WHERE clause with your criteria.

Hope this helps.
 
Here the file net friend...Th AUGuy but with attached file will be easier understand what I mean ;)
 

Attachments

  • Image_001.JPG
    Image_001.JPG
    13 KB · Views: 102
Last edited:
Looks to me that you are creating this table like an Excel spreadsheet. Is there why this is so?

To Sum the columns in Access, you must add:
Code:
Nz([F28]) + Nz([F29]) + Nz([F30])
Access is a database and it's built to sum row-wise using the SUM() function.
 
Exactly vbaInet...like an Excel spreadsheet..but should be nice get the result dragging the mouse just like in Excel...do you think it's possible do the same in access?
 
These two applications were made for different purposes. It's not possible.
 

Users who are viewing this thread

Back
Top Bottom