Tree view of data in a database table. 
Author Message
 Tree view of data in a database table.

I Have a Access database with a table containing references to stars,
the headings of the tables are as follows
id_num stellar_class Code_1 Code_2 Code_3 Description
    1        a 1     Super Giant
    :        :          :      :               :
   21      g 2      v     Main sequence
    :        :          :      :               :
etc.
Autonum   text         text    text text      text

I want the tree view to show all of the contents of the table except the
id_num field as follows

+---a Super Giant
+---b
:
+---g
    +---1
    +---2
+---i
+---ii
:    :
+---v Main sequence
:      :    :     :

Any help on how to achieve this would be a great help,
Thanks in advance,
Anthony Leonard



Mon, 22 May 2000 03:00:00 GMT  
 Tree view of data in a database table.

The quickest way is to use Visual Components'  Outline Data Grid at
http://www.visualcomp.com/dbcomplete/grid.htm.

But if you want to do it yourself, something like the following would do
it:

Sub FillTree()
  Dim rs As Recordset
  Dim nd As Node, ndParent As Node

  Set rs = db.OpenRecordset("SELECT * FROM STARS")

  Do While Not rs.EOF
      ' Find or add parent node
      On Error Resume Next
      Err = 0
      Set ndParent = TreeView1.Nodes(rs!StellarClass)
      If Err <> 0 Then
        Set ndParent = Treeview1.Nodes.Add( , , rs!StellarClass,
rs!StellarClass)
      EndIf
      ' Add new node under parent
      Set nd = Treeview1.Nodes.Add( ndParent.Key, child, rs!StellarClass, _
          rs!StellarClass)
  Loop

End Sub



Quote:
> I Have a Access database with a table containing references to stars,
> the headings of the tables are as follows
> id_num stellar_class Code_1 Code_2 Code_3 Description
>     1        a 1     Super Giant
>     :        :          :      :               :
>    21      g 2      v     Main sequence
>     :        :          :      :               :
> etc.
> Autonum   text         text    text text      text

> I want the tree view to show all of the contents of the table except the
> id_num field as follows

> +---a Super Giant
> +---b
> :
> +---g
>     +---1
>     +---2
> +---i
> +---ii
> :    :
> +---v Main sequence
> :      :    :     :

> Any help on how to achieve this would be a great help,
> Thanks in advance,
> Anthony Leonard




Wed, 24 May 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Tree view of data in a database table.

2. Tree view of data in a database table.

3. Tree view of data

4. Data binding of tree view

5. Is there a way to bind a data set to a Tree view

6. Data Grid and Tree View

7. how to storing tree view in database and avoid concurrency problem

8. Data minding tree view control?

9. TREE VIEW AND DATABASE

10. how to storing tree view in database and avoid concurrency problem

11. Using Tree View Control to store into database

12. Data minding tree view control?

 

 
Powered by phpBB® Forum Software