One of the issues that I ran into was the need to uniquely identify each
node when the TV is loaded with records from more than 1 table where the
primary key for each record is an Autonumber field. Since both table
have an Autonumber, its entirely possible that the same value can exist
in both tables. This isn't a problem until you try to use the values as
the key for the TV since the value would repeat in the TV if left
unaltered. To resolve that problem, I implemented a schema for the node
keys that guarantees uniqueness. Basically the key has three components...
[prefixLength][prefix]:[keyValue]
06ACT

rintInvoice
10INVOICE:85720
09CLIENT:4
09MASTER:4
In my case since I was listing records from both the CLIENTS and MASTER
ACCOUNTS table, the key value of 4 is repeated and thus causes an issue
when using it for a node's key. Using the schema above, I was able to
use the table key for the node key without any further issues.
The first two characters are used to identify the length of the prefix,
including the length and up to and including the colon [:], so that the
key can be extracted if needed to update the related record if needed
using this function...
Function getTreeViewKeyValue(ByRef strString)
getTreeViewKeyValue = Mid(strString, CInt(Left(strString, 2) + 1),
Len(strString) - CInt(Left(strString, 2)))
End Function