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