By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,510 Members | 1,430 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,510 IT Pros & Developers. It's quick & easy.

Treeview control - duplicate keys

P: n/a
MS Access 2000

I have created a large treeview control based on lists of parts. The
nodekey for a part consists of a character followed by the parent
part's index. Some of these parts (e.g., screws) will show up many
times in the same relative position in the treeview. How can I avoid
getting duplicate key error messages? Here's a simplified version of
my treeview control:

Widget 1
Frob a
Frob b
Screw 1
Screw 2
Widget 2
Frob b
Screw 1
Screw 2
Widget 3
Frob a
Frob c
Screw 2
Screw 3

I have tried incrementing the character in front of the part's index
each time I call the recursive subroutine to create a new branch, and
it seems to work, but only to the second level of parts (in my sample
above, the "Frobs" are fine, but not the screws).

Jun 12 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mon, 11 Jun 2007 19:03:53 -0700, Je************@comcast.net wrote:

I have dealt with the same issue by assigning the key as the
concatenation of the various levels it is in. I used a
querystring-like format, e.g.:
Widget 1: w=1
Widget 1 - Frob a: w=1&f=a
Widget 1 - Frob b - Screw 1: w=1&f=b&s=1

Then write a few functions to pick apart the "querystring" (I used a
scripting.dictionary object) and test if a certain element exists.
A key like this comes in very handy when for example the user clicks
on a Screw 1 object: you immediately know what this object is a part
of, without walking the tree.

-Tom.
>MS Access 2000

I have created a large treeview control based on lists of parts. The
nodekey for a part consists of a character followed by the parent
part's index. Some of these parts (e.g., screws) will show up many
times in the same relative position in the treeview. How can I avoid
getting duplicate key error messages? Here's a simplified version of
my treeview control:

Widget 1
Frob a
Frob b
Screw 1
Screw 2
Widget 2
Frob b
Screw 1
Screw 2
Widget 3
Frob a
Frob c
Screw 2
Screw 3

I have tried incrementing the character in front of the part's index
each time I call the recursive subroutine to create a new branch, and
it seems to work, but only to the second level of parts (in my sample
above, the "Frobs" are fine, but not the screws).
Jun 12 '07 #2

P: n/a
I was afraid you were going to suggest this. I have been trying to do
this, with mixed results -- but I recently found that some of the
parts I'd been given had circular references! Thanks for the advice,
I'll slog through it and once I get the data cleaned up, hopefully
this will work.

Regards,

Jenifer
On Jun 12, 12:44 am, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On Mon, 11 Jun 2007 19:03:53 -0700, Jenifer.Aus...@comcast.net wrote:

I have dealt with the same issue by assigning the key as the
concatenation of the various levels it is in. I used a
querystring-like format, e.g.:
Widget 1: w=1
Widget 1 - Frob a: w=1&f=a
Widget 1 - Frob b - Screw 1: w=1&f=b&s=1

Then write a few functions to pick apart the "querystring" (I used a
scripting.dictionary object) and test if a certain element exists.
A key like this comes in very handy when for example the user clicks
on a Screw 1 object: you immediately know what this object is a part
of, without walking the tree.

-Tom.
MS Access 2000
I have created a large treeview control based on lists of parts. The
nodekey for a part consists of a character followed by the parent
part's index. Some of these parts (e.g., screws) will show up many
times in the same relative position in the treeview. How can I avoid
getting duplicate key error messages? Here's a simplified version of....
Jun 12 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.