hello.
found a good example of how to use a treeview for browse through recordsets by Helen Feddema. However, in her example she has only got 2 levels in the tree. I want 3.
It should look something like this.
|-Author
|-Book titles
|-Reviews
I have already managed to populate the tree and everything workes just fine when I have implemented it into my system.
The only thing remaining now is to get the third level in there. I have been trying on my own making a third level (basically copy-paste method using level 2 as source and replacing the different names) but without luck so far. I'm finding it quite difficult wrapping my head around this whole treeview thing to be honest.
So, what do I write to get another level added to my existing code?
Please help me!! Thanks
Here's the code for the first level:
Here's the code for the second level:
found a good example of how to use a treeview for browse through recordsets by Helen Feddema. However, in her example she has only got 2 levels in the tree. I want 3.
It should look something like this.
|-Author
|-Book titles
|-Reviews
I have already managed to populate the tree and everything workes just fine when I have implemented it into my system.
The only thing remaining now is to get the third level in there. I have been trying on my own making a third level (basically copy-paste method using level 2 as source and replacing the different names) but without luck so far. I'm finding it quite difficult wrapping my head around this whole treeview thing to be honest.
So, what do I write to get another level added to my existing code?
Please help me!! Thanks
Here's the code for the first level:
Code:
'Fill Level 1
Set rst = dbs.OpenRecordset(strQuery1, dbOpenForwardOnly)
Do Until rst.EOF
strNode1Text = StrConv("Level1" & rst![LastNameFirst], _
vbLowerCase)
Set nod = .Nodes.Add(Key:=strNode1Text, _
Text:=rst![LastNameFirst])
'Expand the entire node
nod.Expanded = True
rst.MoveNext
Loop
rst.Close
Here's the code for the second level:
Code:
'Fill Level 2
Set rst = dbs.OpenRecordset(strQuery2, dbOpenForwardOnly)
Do Until rst.EOF
strNode1Text = StrConv("Level1" & rst![Initialer], vbLowerCase)
strNode2Text = StrConv("Level2" & rst![Navn], vbLowerCase)
strVisibleText = rst![Navn]
Debug.Print "Text1" & strNode1Text
Debug.Print "Text2" & strNode2Text
Debug.Print ""
.Nodes.Add relative:=strNode1Text, _
relationship:=tvwChild, _
Key:=strNode2Text, _
Text:=strVisibleText
rst.MoveNext
Loop
rst.Close