Solved

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

Posted on 2010-09-21
4
2,085 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

751 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