Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2004

    Question Unanswered: Parent/Child/Grandchild Records

    Can anyone help me?.
    I have 3 tables Customers, Orders, Order Details. I have 1 form with 3 Datagrids. Datagrid1, Datagrid2, Datagrid3.

    I am using the Shape command below.

    Private Sub Form_Load()
    Dim db As Connection
    Set db = New Connection
    db.CursorLocation = adUseClient
    db.Open "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DesignLog.mdb" & ";Persist Security Info=False;Jet OLEDB:"

    Set adoPrimaryRS = New Recordset

    adoPrimaryRS.Open "SHAPE {SELECT * from TblCustomers}APPEND ((SHAPE {select * from TblOrders} APPEND({select * from TblDetails} AS rsDetails RELATE OrderId TO OrderId)) AS rsOrders RELATE CustId TO CustId)", db, adOpenStatic, adLockOptimistic

    Set DataGrid1.DataSource = adoPrimaryRS

    Set DataGrid2.DataSource = adoPrimaryRS("rsOrders").UnderlyingValue

    'Not sure - Set DataGrid3.Datasource = ????????

    What I want to show on the form is when I click a customer in Datagrid1 only Orders linked to that customer will show in DataGrid2 (This bit works ok).

    When I click an order in DataGrid2 only order details linked to that order will appear in DataGrid3. SIMPLE!. How do I do It. I have been trying to get my head round this for days but would really appreciate someone to show me how to do it.

    Thanks in advance.


    End Sub

  2. #2
    Join Date
    Sep 2004

Posting Permissions

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