By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,335 Members | 2,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,335 IT Pros & Developers. It's quick & easy.

Iterating through nodes in a treeview in Ms Access 2003

P: 20
Hi

I am trying to use the Windows treeview in a MS Access application. I want to iterate through child nodes of a particular node but i am failing to figure out how to do it. I have even tried the entire nodes using the following code but am getting an error

For Each objNode In Me.TreeView0.Nodes()

objTree.Nodes.Add objNode.Key, tvwChild, "a" & Genkey, "Define Parameters"
Genkey = Genkey + 1
Next objNode

the error I am getting is runtime error '35606' description control's collection has been modified
Jul 26 '07 #1
Share this Question
Share on Google+
1 Reply


FishVal
Expert 2.5K+
P: 2,653
Hi

I am trying to use the Windows treeview in a MS Access application. I want to iterate through child nodes of a particular node but i am failing to figure out how to do it. I have even tried the entire nodes using the following code but am getting an error

For Each objNode In Me.TreeView0.Nodes()

objTree.Nodes.Add objNode.Key, tvwChild, "a" & Genkey, "Define Parameters"
Genkey = Genkey + 1
Next objNode

the error I am getting is runtime error '35606' description control's collection has been modified
Hi, there.

Use Node.Child property to get first child, use Node.Next property to get next siebling. The following code will show all children of selected node.
Expand|Select|Wrap|Line Numbers
  1.     Dim trvTree As MSComctlLib.TreeView, nodCurrent As MSComctlLib.Node
  2.     Dim i As Integer
  3.  
  4.     Set trvTree = Me.trvGroupsTree.Object
  5.     Set nodCurrent = trvTree.SelectedItem.Child
  6.  
  7.     For i = 1 To trvTree.SelectedItem.Children
  8.         Debug.Print nodCurrent.Text
  9.         Set nodCurrent = nodCurrent.Next
  10.     Next i
  11.  
Jul 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.