Hi all
Access97
The code tv.nodes(tv.nodes.count).EnsureVisible expands
the treeview nodes but not the child nodes.
What do I use to make the total tree to expand?
Idont see the "trees" for the wood
Please help
Loop through all the child nodes, and set their EnsureVisible property as well, e.g.
Public Sub ExpandAll(ParentNode As Node)
Dim ChildNode As Node
Set ChildNode = ParentNode.Child
Do While Not ChildNode Is Nothing
ChildNode.EnsureVisible
ChildNode.Expanded = True
ExpandAll ChildNode
Set ChildNode = ChildNode.Next
Loop
End Sub
No problem, it takes awhile to get used to access alone, much less ActiveX controls. I cheated and cruised the web and downloaded sample code; then was able to locate a .chm file that had documentation.
You can also use your object browser (F2 key) to learn more about various items. Once you have determined properties and methods of the object, you can perform web searches using the ones that interest you, and likely find lots of useful code. You may even find this very message.
You have to trigger the expand-all sub yourself; here's a way to do it:
1) Open the form in design view
2) right click on the tree view control
3) choose 'build event'
4) the module window will open, with the name of the tree control on the left, and a choice of events on the right. Pick a likely event from this list; I think double click would probably be the most reasonable (users will want to double click to expand the entire branch).
5) Once you have chose which event should expand the tree, call the ExpandAll subroutine passing the tree control's selected node as an argument, e.g.
Now, personally, I could care less about stars. I have found that the threads I have put the most effort into, or provided the best answer, often go unstarred. Meanwhile, other threads, such as the one subverting the intrinsic Access security system, seems to get a lot of stars, when it really seems like a poor practice. I therefore consider the star process flawed. Not that it isn't good to see that someone appreciates the effort.
That being said, sometime you may post again and want to give someone a star. It turns out, you can do that, by clicking the 'Mark this post as a helpful/export post' link. You then have to affirm your request in a confirmation dialog, and the star is awarded.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.