VBA code to sum highlighted (1 Viewer)

PhobiaBlu

New member
Local time
Today, 08:59
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

 

jdraw

Super Moderator
Staff member
Local time
Today, 11:59
Joined
Jan 23, 2006
Messages
15,394
no attachment
 

AUGuy

Newly Registered Idiot
Local time
Today, 08:59
Joined
Jul 20, 2010
Messages
135
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.
 

PhobiaBlu

New member
Local time
Today, 08:59
Joined
Jun 26, 2012
Messages
5
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: 77
Last edited:

vbaInet

AWF VIP
Local time
Today, 16:59
Joined
Jan 22, 2010
Messages
26,374
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.
 

PhobiaBlu

New member
Local time
Today, 08:59
Joined
Jun 26, 2012
Messages
5
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?
 

vbaInet

AWF VIP
Local time
Today, 16:59
Joined
Jan 22, 2010
Messages
26,374
These two applications were made for different purposes. It's not possible.
 

PhobiaBlu

New member
Local time
Today, 08:59
Joined
Jun 26, 2012
Messages
5
I assumed vbaInet..th for your patience...till next request:)
 

Users who are viewing this thread

Top Bottom