Solved

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

Posted on 2010-09-21
4
2,112 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 85

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

Independent Software Vendors: 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

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…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

622 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