Hi,

Will Somebody please check this code ?? It is not working but I dont see any problem.
Dim str As String

Dim rst As New ADODB.Recordset

str = "Select Sum(Total) as tot from Purchase where Chalan='" & txtchalan.Text & "'"
rst.Open str, Connection.cn, adOpenKeyset, adLockOptimistic

If rst.RecordCount > 0 Then

txtamount = tot

End if

rst.close
set rst=nothing