-
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?
-
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
-