Access Treeview Tutorial Part 1 – Loading data
The Treeview is a great free part of the Microsoft Common Control Library that lets you create your own Treeview and tie your own data and events into the Treeview. It can present a lot of information in a limited space, and allows a lot more versatility in presenting your information. Combine this with the ability to use small icons for each individual record, you get maximum structure on data presentation.
This is part 1 in a series on how to use the treeview in Access.
This first video demonstrates how to add a Treeview into your form, and how to load information into it. Its all very basic, explained and coded from scratch, with detailed explanations. Later I will upload more advanced guides on the same topic, but this is intended to be a very easy getting started guide.
Good morning,
I have followed your post with interest but I am unable to get the TreeView to work because the references in VBA don’t include the MS Windows Common Controls reference any more (I am using Office 2016). And I am getting a run time error.
I have registered the MSCOMCTL.OCX files correctly but to no avail.
Any help or link to resolve this would be appreciated.
Many thanks
Agustí
Are you getting an error message? Do the nodes load?
Thanks for your reply.
When I debug and compile the VBA project I get the following Compile Error:
User-defined type not defined.
This refers to the tv variable declaration where it is defined as MSComctlLib.TreeView.
Normally I have resolved issues like this by loading the relevant library through Tools > References.
However, I can’t find the reference MS Windows Common Controls in the list of references.
If I use an older 32 bit version of Access the reference is there and the treeview loads fine.
I have done some research on the Internet but I can’t find a solution. I imagine that Access 2016 64bit must have a similar reference library to get the treeview to work.
I hope this helps. Please let me know if you need any further information from me.
Agustí
I will admit, I can no longer keep track of the circus which is Office versioning. Office 365 includes an update mscomctrl library which supports 64 bit.
I don’t recall if there is a version that works in 2016 64 bit. I know that I’ve used 32 bit in 2016.
Many thanks for getting back to me. I will try to contact MS and check with them.
Agustí
I would like to know how you did when you move your mouse over a child it shows as conrolTipText .
I don’t recall doing anything. I figure it just shows as controltip when the text is too wide to show all of it.
I watched carefully this video, i wanted to change icons in a treeview when criteria is verified i thought i could have done it by watching this video but it seems to be more difficult for me now. could you help me with this issue.