Add numbers which are present in db

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ali Rizwan
    Banned
    Contributor
    • Aug 2007
    • 931

    #16
    Originally posted by QVeen72
    Hi,

    Declare a Connection object, Recordset Object :

    [code=vb]
    Dim sSQL As String
    Dim AConn As New ADODB.Connectio n
    Dim RST As New ADODB.Recordset
    With AConn
    .ConnectionStri ng = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=C:\MyDb. mdb"
    .Open
    End With
    sSQL = "Select Sum(Amount) From Table1 Where date Between #" & txtFromDate.Tex t & "# And #" & txtToDate.Text & "# "
    RST.Open sSQL, AConn
    If Not RST.EOF Then
    txtTotal.Text = RST(0) & ""
    End If
    RST.Close
    [/code]

    Replace C:\MyDb.mdb, to ur actual database path

    REgards
    Veena
    Hello Veena
    How can i do this with ADODC1.
    I have three ADODCs on a form and i want to do this (sum of a column,field) with one of them with no date, time anyother restrictions iy just calculates the monthly expenses.
    Thanx

    Comment

    Working...