Treeview in MS Access Part 2: Navigation by treeview


Hi and welcome back to my site for part 2 of my series on using the Treeview in MS Access. This part is about how we can take action based on mouse clicks in the treeview. For now we focus on using the treeview as a means to navigate between records, but you can also use it to navigate between different type of forms just as easily (not included in this video).

You can download the sample DB here:

2003 format:

[download id=”439″]

2007 format:

[download id=”442″]




25 comments on “Treeview in MS Access Part 2: Navigation by treeview
  1. ahmed says:

    after downloading the 2007 file format, it was found not working on access 2013.. 🙁

    • TheSmileyCoder says:

      Hi Ahmed. I have heard rumours that the treeview could not work in Access 2013. I have not yet had the chance to try it out. Are you using 32 or 64 bit office?

      • TheSmileyCoder says:

        I recently had the option of using the treeview in Access 2013 32 bit. It worked just fine with the brief testing I performed.(Thanks to Crystal Long for help testing)

        • Brian says:

          Opening your accdb on Access 2013 32-bit on Windows 7 32-bit results in strange behavior. The treeview is usable in that you can open/close nodes, select nodes, add nodes, etc. However, the ActiveX events don’t fire. Additionally, the ActiveX events appear in the VBE drop-down menu only until I save it on my local machine, and then only the standard Access container events appear in that menu.

          Furthermore, I am also experiencing [this issue]( with Access 2013 32-bit on Windows 7 32-bit, and Access 2013 64-bit on Windows 8 64-bit.

          I think it’s safe to say that treeviews are broken in Access 2013, for me at least.

          Which version of Access did you use and on which version of Windows? Can you confirm that the events fire, and that they appear in the VBE dropdown menu when you open your accdb in Access 2013?

  2. Nicole says:

    Hi, I’m working on a project with two tables sharing a common field. The recordsets on each table for these fields are different and we only want to pull information from one of the tables. One of the tables has a standard primary key using the autonumber ID but the other is based on a different number; the number that has to match up with the common field on the other table. The treeview has already been set up and works, I’m pretty sure the node key works as well but I cannot get the last line where the 2nd form matches up to my tree to work. If you have any advice I would greatly appreciate it. Thanks.

    • TheSmileyCoder says:

      Hi Nicole
      Sorry for the late reply. Summer holidays 🙂

      I will drop you a mail, and maybe we can connect and I can show you how its done. Its a bit long for a post here.

  3. SHallo says:

    Hi Yah,

    I am using MS Access 2010. I’ve followed your video and found it extremely helpful. However, I am struck with the events (Part 2). For some reason I am unable to find the Node_click event on the treeview. I’ve tried getting into the Updated event (Code window) and then tried to click the drop down to search for further events but unfortunately, I am unable to see any further events. Am I missing anything or is this not provided in 2010 version? Any help would be highly appreciated.

  4. SHallo says:


    I’ve got it now…My code window was referring to Microsoft Windows Common Controls 5.0 which I’ve changed to Microsoft Windows Common Controls 6.0

    Thank you very Much.

  5. zspring says:

    I appreciate all of your postings on the TreeView control – they have been extremely helpful in the application I am developing. I have a TreeView control set up from which I can navigate to specific forms by clicking on the corresponding node. I would like to know if there is a way to click a command button on the specific form and open the TreeView form with the TreeView control expanded to the corresponding node.

    • TheSmileyCoder says:

      Hi zspring. Sorry for the delayed reply.
      I usually do a re-build of the treeview right before any goto-action. This since in a multiuser environment the ID I want to go to, could be created only seconds before by a co-worker who now wants an assist. To prevent trying to go to a record which is not available in the GUI, I thus rebuild just before navigating.

      Anyways, I will also usually have several “goto” buttons, to allow for quick navigation. So lets say you want to navigate to X with an id of 78. You need to find out which form X logically belongs to, which you can do using Dlookups for example. Then have your code open the relevant form, and refresh the treeview. To actually navigate to the treeview node, you can use:

      I hope that hepls a bit. Otherwise don’t hesitate to ask. Its really a subject that could be big enough for a blog post of its own.

      Best regards
      TheSmileyCoder // Anders Ebro

  6. AC-Loo says:

    Hi TheSmilyCoder, Thanks for sharing your tutorial on the Treeview control.
    Here’s my question:
    I have a DB with 4 tables that are related in a sort of hierarchy (1st table is parent to the 2nd which is parent to the 3rd table which is parent to the 4th table) I was wondering if the Treeview control can be used on multiple related tables? Or do I have to merge them in a single table for it to work? Thank you,

    • TheSmileyCoder says:

      Hi AC-Loo
      First and foremost, your design should always be ruled by database normalization. A good database structure is paramount to all other requirements.

      And no, you do not need to merge the tables, you can have any amount of different tables in your treeview, and that is one of the things I love about it.

      I can try to outline the process briefly as a post with all the details is a bit beyond my current time restraints.

      Lets take an example of folders, with files in them. The basic pseudocode would look like this:
      Open both recordsets.
      Do while not rsFolders.Eof

      With the addSubfolders procedure, you will need to also add files and subfolders.

      I will keep this in mind and possibly make it the target of my next video. Thank you for your feedback.

  7. Christian says:

    Hi there,

    Thank you so much for this tutorial.
    Anyway, what is the difference of sample database in 2003 and 2007 format?

    When I opened 2003 version in 2007, there was error about ‘can’t find project library’
    But yes off course, 2007 version is fine when I opened in 2007.

    • TheSmileyCoder says:

      Odd. Far as I can tell both should work. That said both are made in Access2010. I would open up the references and take a look. Perhaps the 2003 version needs to have its office references “downgraded” manually?

  8. Chris Worthington says:

    I had to change code from Form_Load to TreeReqs_Enter for example to run as expected. But thank you for expanding my understanding of TreeView.

    Incidentally I think Microsoft should be made aware that it is unacceptable to NOT make TreeView work in 2013 without having to recode the application. This makes it very hard to share an application between users who might have 2007, 2010 or 2013 running on their system

    • TheSmileyCoder says:

      In principle I agree with you. I wish they would just make the treeview be integrated in Access as a native control. But from the Access teams point of view, I think they consider it a third party software and as such a “Use at your own risk” kind of thing.

  9. amrut says:

    Hi, thanks for nice tutorials. I have three related tables similar to what AC-Loo has mentioned. The form is set up with Parent-Child-Grandchild relationship. I am trying to navigate to a record when a node is clicked.It requires 2 or 3 clicks to navigate to it. I used the same code in AfterUpdate event of a Combo Box whose row source is the GandChild table and it works perfectly (finds and navigates to correct record).. What am I missing ? I have asked this at a forum too.
    Here is link –
    I appreciate your help.

    • TheSmileyCoder says:

      I’ve taken a shot at your code on the forum. If that doesn’t work just drop me an email. I do this sort of thing regularly.

  10. Hen says:

    Hi. Thank you for your tutorials,! I have a question regarding part 6….for some reason access doesn’t recognize CtrlSubForm command. is there any specific reference I need to add? thanks for your help. BR

    • TheSmileyCoder says:

      As I recall there is no “ctrlsubform” command. Could you try to specify more, or possible say at what time I the video there is a problem?

  11. Munir says:

    Hi, I have an mdb tree view family database. it is working fairly well, but when i tried to convert it to accdb the tree view form has broken. please help

    • TheSmileyCoder says:

      There is nothing specific about the accdb format that would cause it to “break”. What error messages are you getting?

  12. mohamed gamal says:

    i need example for access 2013
    thank you

Leave a Reply to amrut Cancel reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.