Results 1 to 3 of 3

Thread: [RESOLVED] print loop data using data report

  1. #1

    Thread Starter
    Member kirara22's Avatar
    Join Date
    Feb 2009
    Posts
    54

    Resolved [RESOLVED] print loop data using data report

    Code:
    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
    plz help .tnx

  2. #2
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,510

    Re: print loop data using data report

    Not clear on what your doing, need more info.
    If you want to display the field "GTotal" then assign it to a text box control.

    Code:
    rptAssessment.Sections("users_header").Controls.Item("txtGTotal").DataMember = "users"
        rptAssessment.Sections("users_header").Controls.Item("txtGTotal").DataField = "GTotal"

  3. #3

    Thread Starter
    Member kirara22's Avatar
    Join Date
    Feb 2009
    Posts
    54

    Re: print loop data using data report

    tnx wes4dbt for ur reply

    ive already solved my problem..

    my posted code is working.. it is just i didnt set the correct datareport properties: datasource and datamember
    Last edited by kirara22; May 25th, 2009 at 12:05 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width