Results 1 to 6 of 6

Thread: [RESOLVED] Error in datareport

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    169

    Resolved [RESOLVED] Error in datareport

    Hi friends ,

    I am getting following error in datareport using dataenvironment

    "failed getting rowset(s) from current datasource" .Please help.

    My code is

    Code:
    Private Sub cmdprint_Click()
    Dim chq As String
            chq= "cheque"
    Dim sr As String
            sr = "select *  from " & chq& " where cheque_no= '" & Text1.Text & "' "
    
       'DataEnvironment1.Connection1.Close
       DataEnvironment1.Connection1 = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\cheque.mdb"
       DataEnvironment1.Connection1.Open
    
       DataEnvironment1.Commands.Item(1).CommandType = adCmdText
        DataEnvironment1.Commands.Item(1).CommandText = "select *  from " & chq & " where cheque_no= " & Text1.Text & " "
        'DataEnvironment1.Command1 = Str(DataEnvironment1.Commands.Item(1).CommandText)
    
       Debug.Print DataEnvironment1.Commands.Item(1).CommandText
    If DataEnvironment1.Connection1.State > 0 Then DataEnvironment1.Connection1.Close
    
        DataEnvironment1.Connection1.Open
       DataEnvironment1.Command1
    
    
    
    Set DataReport1.DataSource = DataEnvironment1
    Debug.Print DataReport1.DataMember
    DataReport1.DataMember = sr
    
    
    Debug.Print DataReport1.DataMember
    
    DataReport1.LeftMargin = 1200
    DataReport1.TopMargin = 1000
    DataReport1.BottomMargin = 1000
    DataReport1.Show
    
    End Sub

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

    Re: Error in datareport

    if "sr" is the name of the DE command then try this

    datareport1.datamember = "sr"

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    169

    Re: Error in datareport

    I changed to ser.but still same error comes

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Error in datareport

    What is ser?

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

    Re: Error in datareport

    I don't understand what ser is either.
    I also don't understand why your using a DE, you can use an ADO recordset. Just do this
    Code:
    dim rs as New ADODB.Recordset
    
    rs.open "select *  from " & chq& " where cheque_no= '" & Text1.Text & "' ", yourconnection
    
    Set Datareport1.datasource = rs
    Datareport1.datamember = rs.Datamember
    Datareport1.Show vbModal

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    169

    Re: [RESOLVED] Error in datareport

    Thanks a lot.It is working fine.

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