Solved

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

Posted on 2010-09-21
4
2,040 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
Comment Utility
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
Comment Utility
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
Comment Utility
Complete solution provided
0
 
LVL 3

Expert Comment

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

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now