View Full Version : Multiple Hierarchies from a Single Table


Thales750
01-17-2011, 05:30 AM
In a multiple predecessor task list; If you desire to see the whole picture, it become problematic. I suspect the Microsoft Tree Control would lend itself to displaying this structure. If it would work, does anyone know where one is located that I could examine?

Multiple predecessor task list, a simple way to create this list is to use a link table.

tblTask
TaskID
TaskDescription
TaskWhateverOtherElse

tblTaskSusTask
TaskSubTaskID
TaskID ‘This is a foreign key from tblTask and defines the task
SubtaskID ‘This is a foreign key from tblTask and defines the sudtask

As you can see you can create an infinitely deep relationship between and infinite number of task with an infinite number of predecessors. If you need to display a single connection, a simple form with related subforms will manage this structure.

However we need a way to see the big picture

Years ago we had a C# applet that would translate the data to MS Project and use the display but that app was dedicated to a single structure and that C# programmer is no longer available.

lagbolt
01-17-2011, 11:31 AM
You can use a tree control to show parts of this structure, but note that any particular node might have many parent nodes and many child nodes. If the sub-task is always and only ever a child of a task, then consider this structure, which is much simpler ...
tTask
TaskID (Primary Key)
ParentTaskID (Foreign Key - Links to TaskID in this table)
TaskDescription
TaskWhateverOtherElse
With this structure a node can only have child nodes.
You can add an ActiveX treeview control to your form in design view. Click the 'ActiveX Controls' button in the toolbox and drop it on your form. Select the latest version of the item called Microsoft Treeview Control. Note that this adds a reference in your project to a file called MSComCtlLib.ocx.

gemma-the-husky
01-18-2011, 01:32 AM
I suspect the problem is not clearly defined.

What sort of structure are you trying to define?

if the whole system is ordered, then presumably its not too tricky.

however if its recursive then it must be difficult to model (ie it sounds like you can in principle define the sub-task of a task to also be a predecessor of the task.

Am I missing something.


-------------
but in general directly representing ordered trees, queues, and stacks etc within VBA is not easy, because of the absence of a native pointer data type.