Solved

Clearing the child nodes of a node in a treeview in vba

Posted on 2010-09-21
4
2,076 Views
Last Modified: 2013-11-27
How can I clear the child nodes below a given parent node in a treeview control using vba. I know how to clear all the nodes in a treeview using:

mObjTreeView.Nodes.Clear

Open in new window


I've tried code:

mObjTreeView.Nodes(mObjParent.Index).Nodes.Clear

Open in new window


but it won't compile. Is the syntax wrong or can I just not do what I'm trying to do so simply? If I need a sub-routine, can anyone get me started?
0
Comment
Question by:colevalleygirl
  • 2
4 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 33725388
Which Treeview are you using? There are several, and some of them are 3rd party controls.

Here's how to clear the ChildNodes of the VBA treeview:

http://www.veign.com/code-view.php?type=app&codeid=35

Note also that the Treeview is not a verfied control in Access, therefore you may experience some odd issues.
0
 

Author Comment

by:colevalleygirl
ID: 33726648
I'm using the TreeView Windows Common control. The code you pointed me to works fine, although I've modified it to identify the parent node via its index.

Thanks
0
 

Author Closing Comment

by:colevalleygirl
ID: 33726660
Complete solution provided
0
 
LVL 3

Expert Comment

by:yahooooo
ID: 39215065
yup works fine but that code should remove nodes from database as well... What the point other way?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question