[AccessD] Recursive data in treeview control

Bryan Carbonnell Bryan_Carbonnell at cbc.ca
Thu Feb 12 08:18:04 CST 2004


Hope it works for you.

Bryan Carbonnell
bryan_carbonnell at cbc.ca

>>> roz.clarke at donnslaw.co.uk 12-Feb-04 6:34:15 AM >>>
thanks Bryan. you're a star.

-----Original Message-----
From: Bryan Carbonnell [mailto:carbonnb at sympatico.ca] 

On 12 Feb 2004 at 10:40, Roz Clarke wrote:

> Does anyone have any code for recursively populating a treeview 
> control? I have a table like this:
> 
> TaskID		ParentID	Description
> 1		0		fleg
> 2		1		subfleg a
> 3		1		subfleg b
> 4		2		sub-subfleg a
> 
> and so on. I don't want to limit the number of levels.
> 
> I can see that I need to run through the dataset and populate the 
> treeview with the first level, then do it again n times until all the

> children are added at the appropriate level, skipping any record 
> already added as a node.
> 
> I'm in a hurry - I have 2 hours to nail this (working hours not
> real-time) so although it feels lazy and I would love to crack this
on 
> my own, if anyone has done it before I would appreciate any help you

> can give.

Roz,

That is sort of the approach I too in my Treview Switchboard wizard.

Here is the code I pulled out of it. If I missed any functions, you 
can download the wizard from:
http://www3.sympatico.ca/carbonnb/bryan/Access/TreeViewSB.html 



More information about the AccessD mailing list