|
-
Feb 6th, 2000, 01:15 PM
#1
Thread Starter
Junior Member
I have a database that has a column that contains "CustomersTotals". I need my program to add all of the "CustomersTotals" together and present the total in a lblTotal. I can code everything ecept how to add all of the values that were in the column of "CustomersTotals". Please help me out.
How do you add all currency entries in a column together?
-
Feb 6th, 2000, 11:44 PM
#2
You can do something like this:
Code:
Dim db As Database
Dim rs As Recordset
Set db = Workspaces(0).OpenDatabase("C:\MYDB.mdb")
Set rs = db.OpenRecordset("Select SUM(CustomersTotals) From Customers", dbOpenSnapShot)
If not rs.EOF Then
lblCustomersTotals.Caption = rs(0)
End If
In this example, I used database C:\MyDB.mdb and a table Cutomers. You can change them to appropriate names. Also, you would have to add a reference to Microsoft DAO library.
------------------
Serge
Senior Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
-
Feb 7th, 2000, 03:36 AM
#3
Thread Starter
Junior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|