How to geta total of a column of access in visual basic
I need to get a total of a specific column of a table of access db in a text box in my visual basic application. What should be the code? I am using adodc to connect with the database.
Help urgent please..........
Would you please explain a bit more? I am not so expert in codeing. In formload i want to get it. Table name is report, Db name rate. So then......what?
Dim db As Database
Dim rs As Recordset
Dim tot As Double
Set db = OpenDatabase(App.Path & "\rate.mdb")
Set rs = db.OpenRecordset("report", dbOpenTable)
tot = 0
If rs.RecordCount > 0 Then
rs.MoveFirst
While Not rs.EOF()
tot = tot + rs!basic_pay
rs.MoveNext
Wend
End If
Text1.Text = tot