plz help .tnxCode:Private Sub Command1_Click() Dim MyDates As Date For MyDates = DateSerial(2009, 5, 1) To DateSerial(2009, 5, 31) Debug.Print MyDates DBPATH = App.Path & "\db1.mdb" Dim cn As New ADODB.Connection, rs As New ADODB.Recordset cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPATH SQL = "Select SUM(amount) As GTotal from table1 WHERE Date=" & MyDates & " " rs.CursorType = adOpenDynamic rs.LockType = adLockPessimistic rs.Open SQL, cn, , , adCmdText TotalAmount = rs.Fields("GTotal") 'Debug.Print TotalAmount ----> using this i got the ryt output for totalamount but i need it to be displayed in my datareport 'DataReport2.Sections("Section2").Controls("lblNew").Caption = DataReport2.Sections("Section2").Controls("lblNew").Caption & Chr(10) & totalamount ----> I've try using this code but there where no output displayed in my datareport rs.Close cn.Close Next End Sub![]()




Reply With Quote