calculate sum of all record valyee of column & display in vb form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vipulg
    New Member
    • Oct 2012
    • 1

    calculate sum of all record valyee of column & display in vb form

    I have an ms access database with table xyz in that there arre three coulmn .i want to do addition of my first column value . & that addition i want to display in vb 6.0 form which having one text box
  • smartchap
    New Member
    • Dec 2007
    • 236

    #2
    You can do it easily using DAO.
    After opening database use following code to see the result in a text box (modify as per your requirement):
    Code:
    Private Sub Command1_Click()
        'MsgBox rs.Fields("Col1").Value
        rs.MoveFirst
        For i = 1 To rs.RecordCount
            Text1.Text = Val(Text1.Text) + Val(rs.Fields("Col1").Value)
            rs.MoveNext
        Next
        
    End Sub

    Comment

    Working...