Clear Tree View

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Thanks for taking the time to read my question.

I have a tree view that I would like to generate on the onCurrent event of a
form. It works for the first record you open the form to, but when you try
to move to another record, it crashes. I says: "Key is not unique in
collection." I'm guessing that is becuase I have not cleared the Tree View
and the code I got from Microsoft uses one variable.
(http://support.microsoft.com/?kbid=209898)

How do you clear the Tree View to see the next record?

Thanks,

Brad
 
I got lucky and found this.

If Me!xTree.Nodes.Count > 0 Then
Me!xTree.Nodes.Remove 1
End If

xTree is the name of the Tree View

1 = the first node. Clear that, and you get rid of all the nodes. You can
put another number in there that referrs to a different node.

Thanks,

Brad
 
Back
Top