Results 1 to 3 of 3

Thread: [Resolved] Not able to access rows in child recordset

  1. #1

    Thread Starter
    Hyperactive Member Utpal's Avatar
    Join Date
    Feb 2002
    Location
    Mumbai, India
    Posts
    393

    [Resolved] Not able to access rows in child recordset

    Hi everybody,
    I am not able to access the rows in a child recordset of a hierarchial recordset, generated using MSDataShape. Following is the code :

    Code:
    Private Sub Report()
    
        Dim ConnShape As New ADODB.Connection, _
            rPrint As New ADODB.Recordset, rPrintChild As Variant
    
        With ConnShape
            .Provider = "MSDataShape"
            .Open "Shape Provider=" & Provider & _
                ";driver={SQL Server}" & _
                ";server=" & DataSource & _
                ";uid=" & UserID & _
                ";pwd=" & Password & _
                ";database=" & "InvMEDI2001"
        End With
    
        With rPrint
            .StayInSync = False
            .Open "SHAPE {SELECT * FROM UOM_Master} " & _
                    "APPEND ({SELECT * FROM Conv_Master} " & _
                    "RELATE uom TO uom) AS Conv", _
                ConnShape, adOpenForwardOnly, adLockReadOnly, adCmdText
            Do Until .EOF
                Debug.Print .Fields("uom").Value
                Set rPrintChild = rPrint("Conv")
                Do Until rPrintChild.EOF
                    Debug.Print rPrintChild(0), rPrintChild(1)
                    MoveNext
                Loop
                .MoveNext
            Loop
        End With
    
    End Sub
    On running this procedure, it shows the error "Object doesn't support this property or method." at "Do Until rPrintChild.EOF". I am using ADO 2.0 Library. I tried using ADO 2.1 & 2.5, but that doesn't help. Please help me.
    Last edited by Utpal; Jul 3rd, 2002 at 05:19 AM.
    It is easy when you know it.

  2. #2
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796
    I think that to get a handle on the child recordset, you must set a recordset object to the value of the field and not field itself:
    VB Code:
    1. Set rPrintChild = rPrint("Conv").Value
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  3. #3

    Thread Starter
    Hyperactive Member Utpal's Avatar
    Join Date
    Feb 2002
    Location
    Mumbai, India
    Posts
    393
    Thanks Simonm ! That worked.
    It is easy when you know it.

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