Adding numeric values to a TreeViewControl?

The Stoat

The Grim Squeaker
Local time
Today, 21:37
Joined
May 26, 2004
Messages
239
Hi all,

I am populating a tree view control from data in a table. However i get the error message 'Run time error 356003 invalid key' when i try to add a childnode that is numeric.

Code:
With my treeview.nodes

.add StrParent, twvChild, StrChild,StrChild

end with



If i replace StrChild with "1" i still get the same problem.

I can solve the problem by checking for numeric values in Strchild and adding a character to the string , i choose [] i.e. [100] but i wondered a) why this is happening 2) can you get round it?

Cheers

TS
 
Pad the Key with Zeros (0)

Example for Key value only:

when strChild=1

Key value would = "0000000001"

You can do this by formula:

StrKey=Right("0000000000" & strChild,10)

This will take the Right 10 Characters. You could then use the VAL function to get the numeric value of the Key if necessary.
 
Hi Travis,

That is an interesting solution but i think it will be confusing for the people using the data. The values relate to medical observations and therefore need to be precise. I managed to solve the problem though i'm not sure why it works (something i usually can't abide :mad: ).

Code:
With my treeview.nodes

.add StrParent, twvChild, StrChild  & ";" ,StrChild

end with



Thanks for your help and time :)

TS
 

Users who are viewing this thread

Back
Top Bottom