Results 1 to 3 of 3

Thread: (txt)...

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    25

    Post

    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?

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    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

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    25

    Post

    Thanks, Serge.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width