I have a treeview control that breaks in the code when I try to
populate it with parent nodes. It stops with the very first node and
either gives me a "type mismatch" or a "key is not unique in
collection" error. The line of code it stops on is this one:
Set nod = objTree.Nodes.Add(, tvwLast, strRootKey, strTaskType, 0)
(strrootkey = "Root " and then a unique task name)
(strtasktype = the unique task name)
This code and control worked in my MS Access 97 version of my program.
I am currently rebuilding it in MS Access 2003 and have hit this wall.
I have set all the properties that same (as far as I know) in the
properties window and the TreeCtrl Properties (double click) window. I
have printed out the parameters for the object.add method from MSDN.
They look correct to me.
Please tell me what I'm doing wrong. If I've omitted any data that
would be helpful, please tell me and I'll add more. Thank you in
advance for your help.
Alex Dybenko - 05 Oct 2004 07:05 GMT
Erika,
can't say for sure what can be the problem as i don't see the whole thing.
but try to check that nod is declared as comctl.node or mscomctl.node (could
be other node objects from other libraries)
then last argument - 0 - try to omit it.
also check that you dont have references to both common controls 5 and 6
library, use only one

Signature
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com
>I have a treeview control that breaks in the code when I try to
> populate it with parent nodes. It stops with the very first node and
[quoted text clipped - 16 lines]
> would be helpful, please tell me and I'll add more. Thank you in
> advance for your help.
Erika - 05 Oct 2004 19:58 GMT
Thank you so much, Alex, the mscomctl.node change did the trick!
> Erika,
> can't say for sure what can be the problem as i don't see the whole thing.
[quoted text clipped - 3 lines]
> also check that you dont have references to both common controls 5 and 6
> library, use only one
bobo - 28 Nov 2004 08:49 GMT
> I have a treeview control that breaks in the code when I try to
> populate it with parent nodes. It stops with the very first node and
[quoted text clipped - 16 lines]
> would be helpful, please tell me and I'll add more. Thank you in
> advance for your help.