Still having issues with Unique Key

Dave 14867

Registered User.
Local time
Today, 10:23
Joined
Jan 1, 2017
Messages
56
Hello all,
I am having issues trying to track down the "Unique Key error" that is happening.

Can someone please help me understand the code better so I can track down what is happening? I have attached the file and if you open "frmExpandAssembly", then pick the first assembly in the list, select a qty of 1 then hit expand assembly, it will cause the error.

I just don't know enough VBA yet to determine exactly how to correct the problem.

View attachment Dave Attempt-2 2-25-18 with error.zip

Thanks

Dave
 
I got a type mismatch error (13)
Is that different from your error?
 
Ridders,

I had forgotten to change the code back to the original code before I tried to edit it.

Delete the "<Type>Comment</Type", from line 93 and comment out line 77 and uncomment out line 76.

I just don't know which items are causing the problem and how to fix it. I believe the tvChild and something else (possibly InStr) have the same ID but I am not sure.

Thanks
Dave
 
You are using a combination of ParentAssemblyID + "C" + PartID to form the NodeID. This is not always giving a unique NodeID which is required.

I can see two occurrences each of 223C250, 223C529, 223C530

Either there is a problem with your underlying parts data or an incorrect choice of generating a unique ID for your tree.
 
Cronk,

I don't believe the data is incorrect (but not positive), can you edit or generate the unique ID differently (comment out existing line please) so I can see how else to do it?

Thanks

Dave
 
I notice that tblAssemblyPartsList, which contains the data being fed into the Treeview, has a unique ID (NodeID). You could use that.
 

Users who are viewing this thread

Back
Top Bottom