by crimson/hunter (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 27th September 2007
Date Added: Mon 8th February 2021
Rating: (1 Votes)
summation function of column using msql codes
rs.Open "colector", con, adOpenDynamic, adLockOptimistic
rs.MoveFirst
If rs.BOF = True Then
Label1.Caption = .Fields("principal") 'store the 1st row
Else
Label2.Caption = 0 'return the 2nd storage to 0
Label2.Caption = val(Label1.Caption) 'pass value to 2nd storage
While Not rs.EOF
Label2.Caption = val(Label2.Caption) + val(rs!principal) 'add the remaining value in the selected field
rs.MoveNext
Wend
End If
rs.Close