Oliver2003
Technical User
I am not familiar with the treeview control and was wondering if it is possible to display linked data from tables using a root item for the data in the first table, then a child for the data related to this root from the second table and then another child to display data from the third table that is related to table two.
Don’t know if Im describing it that clear, Something like this:
-Root(table1)
+Child(table2)
+Child(table2)
-Child(table2)
--Item(table3)
--Item(table3)
+Root(table1)
+Root(table1)
The tables are linked by a autoID number, the relationship is like this:
Table1-------Table2--------Table3
i.e. Table1 is the main table, table2 is a sub table of table1 and tablee3 is a sub table of table2.
I found this example from planet source code, but not sure how to add the third or more levels?
oRS.Open "SHAPE {SELECT employeeid,FirstName, " _
& "LastName FROM employees} " _
& "APPEND ({SELECT OrderID, shipname, employeeid " _
& "FROM orders WHERE shipname ='Save-a-lot Markets'} " _
& "AS oRSOrder " _
& "RELATE EmployeeID TO EmployeeID)", oConn
Do While Not oRS.EOF
Set oparNode = TreeView1.Nodes.Add(Text:=oRS.Fields(0) _
& " " & oRS.Fields(1) & " " & oRS.Fields(2))
Set oRSChild = oRS.Fields("oRSOrder"
.Value
Do While Not oRSChild.EOF
TreeView1.Nodes.Add relative:=oparNode.Index, _
relationship:=tvwChild, Text:=oRSChild.Fields(0) _
& " " & oRSChild.Fields(1)
oRSChild.MoveNext
Loop
oRS.MoveNext
Loop
Thanks for your help
Don’t know if Im describing it that clear, Something like this:
-Root(table1)
+Child(table2)
+Child(table2)
-Child(table2)
--Item(table3)
--Item(table3)
+Root(table1)
+Root(table1)
The tables are linked by a autoID number, the relationship is like this:
Table1-------Table2--------Table3
i.e. Table1 is the main table, table2 is a sub table of table1 and tablee3 is a sub table of table2.
I found this example from planet source code, but not sure how to add the third or more levels?
oRS.Open "SHAPE {SELECT employeeid,FirstName, " _
& "LastName FROM employees} " _
& "APPEND ({SELECT OrderID, shipname, employeeid " _
& "FROM orders WHERE shipname ='Save-a-lot Markets'} " _
& "AS oRSOrder " _
& "RELATE EmployeeID TO EmployeeID)", oConn
Do While Not oRS.EOF
Set oparNode = TreeView1.Nodes.Add(Text:=oRS.Fields(0) _
& " " & oRS.Fields(1) & " " & oRS.Fields(2))
Set oRSChild = oRS.Fields("oRSOrder"
Do While Not oRSChild.EOF
TreeView1.Nodes.Add relative:=oparNode.Index, _
relationship:=tvwChild, Text:=oRSChild.Fields(0) _
& " " & oRSChild.Fields(1)
oRSChild.MoveNext
Loop
oRS.MoveNext
Loop
Thanks for your help