Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help--error 35602---key not unique in collection 1

Status
Not open for further replies.

wujen

Programmer
Aug 21, 2001
79
US
Hey all,

I have this problem

I have mdi form with 6 cmdbuttons that on click load 6 diferent treeviews. The tvw1 is the default, loads with the form. When I click thru the first time --not a problem. But if I try to click to return the proir treeview I get this error---- error 35602---key not unique in collection. How do I get this error to go bye bye.

Aaron
 
You're trying to load a node into the treeview containing a key that's already been loaded...look for duplicate records in your recordset.

 
Mark,

The cmdbutton is to reload(if the user changes it) the treeview data? THe treeview is a listing of data element(non-changable)

Aaron
 
If the element data is static and the treeview is simply being reloaded, then the treeview must be emptied (twv1.nodes.clear) before you can reload the same data with the same key elements.

If the data is able to be changed by the user, you've got to make sure the Key does not exist in any of the treeview nodes before you add the node to the tree. All Keys must be unique and if you try to add a node with a key that already exists in the tree the error you described is encountered.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top