Results 1 to 2 of 2
  1. #1
    mrfixit1170 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    42

    Populating a Treeview with 6 levels

    Hello everyone and good day,
    I have a question about the treeview property, I am using a query technique found at another site (MyMSAccessBlog.blogspot)it is an article. I can recreate the tree with two levels, but I am having trouble with level 3 thru 6. Here is a sample of the query:

    Code:
    SELECT "M" & [FG_Categories].[FG_ID] AS MenuNodekey, FG_Categories.MenuName, "S" & [FGC] AS SubMenuNodekey, SubCategories.SubMenuName, SubCategories.Node
    FROM FG_Categories INNER JOIN SubCategories ON FG_Categories.FG_ID = SubCategories.FG_ID
    WHERE (((SubCategories.Node)="2"))
    ORDER BY "M" & [FG_Categories].[FG_ID];
    I placed the "WHERE node = 2" in the group to limit only 2 levels. If I don't I get 29 (Level1) Parent Nodes and then 700(Level 2) Child nodes.
    As I understand it the Level 3 Child nodes are going to have Parent Node elements of the level 2 nodes, which are child nodes of level 1.

    What I can not figure out is how to rekey the child nodes at level 2 for setting up level 3 nodes in my query. I can do all of this by hand jamming.
    Code:
    Me.tvwtest1.Nodes.Add Text:="Menu", Key:="MenunodeKey"
            Me.tvwtest1.Nodes.Add Relationship:=tvwChild, relative:="MenunodeKey", Text:="General Maintenance", Key:="L0101"
    Me.tvwtest1.Nodes.Add Relationship:=tvwChild, relative:="MenunodeKey", Text:="Warranty", Key:="L0102"
    Me.tvwtest1.Nodes.Add Relationship:=tvwChild, relative:="L0101", Text:="Engine", Key:="L010101"
    Me.tvwtest1.Nodes.Add Relationship:=tvwChild, relative:="L0101", Text:="Intake", Key:="L010102"
    Me.tvwtest1.Nodes.Add Relationship:=tvwChild, relative:="L0101", Text:="Exhaust", Key:="L010103"
    Me.tvwtest1.Nodes.Add Relationship:=tvwChild, relative:="L0102", Text:="Annual", Key:="L010201"
    Me.tvwtest1.Nodes.Add Relationship:=tvwChild, relative:="L0102", Text:="Mileage", Key:="L010202"
    but I'd rather not. If there is a better way to write the query or instead of hand jamming 700 line of nodes at 6 levels, I'd love to hear...and I will pass it on.



    Thanks

  2. #2
    mrfixit1170 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    42

    Have I not ask the question correctly?

    Just wondering if anyone has any input?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to sum at levels in a query
    By Sck in forum Queries
    Replies: 2
    Last Post: 12-08-2010, 09:39 AM
  2. Treeview Example
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-30-2010, 10:58 PM
  3. Treeview
    By eddiewills in forum Programming
    Replies: 0
    Last Post: 08-18-2010, 01:05 PM
  4. Login and user levels
    By seanog2001 in forum Forms
    Replies: 0
    Last Post: 10-27-2009, 05:13 AM
  5. P&P Treeview
    By Teejay in forum Programming
    Replies: 0
    Last Post: 10-04-2009, 03:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums