Link to home
Start Free TrialLog in
Avatar of Nikolay DMITRIEV
Nikolay DMITRIEVFlag for Switzerland

asked on

MS Access Treeview subform

Dear Experts,
I desperately need to make subform with tree view.
Since years managed to avoid same, as numerous examples on the web are beyond my understanding. Some of them tried but never worked (incl:http://www.jkp-ads.com/). TreeviewControl stopped working long time ago.
Is there any "relatively simple" way to do same? Two levels will be enough: Chapter=>Subchapter based on two table: tblChapter (parent) linked tblSubchapter (child). Maybe you can recommend smth?

Thanks in advance
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Maybe emulating one with a couple of extra text controls would be the best.

If your always going to have only two levels, then it should be doable.

Jim.
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nikolay DMITRIEV

ASKER

Good day Jim,

Thanks for a hint. It will take time...I'm approaching to treeview periodically since years... no need to keep this questione opened.
Will update if it works.
Let me know if I have granted points in a wrong way..
Thanks for support and best regards,
hotelguest,

Treeviews really are not that difficult to deal with, once you get the hang of it.

There are several ways to approach this.  If you have a hierarchical table, then you will need to recursively call the same function passing the the value of the parent node.  But when you have two tables like you have described, you might be able to do it with a Union query that looks something like:
SELECT ID, Description, Child_ID, Child_Description
FROM (
SELECT A.ID, A.Description, 0 as Child_ID, Null as Child_Description
FROM Table1
UNION ALL
SELECT A.ID, A.Description, B.ID as Child_ID, B.Description as Child_Description
FROM Table1 as A INNER JOIN Table2 as B ON A.ID = B.Parent_ID
) ORDER BY Description, Child_Description

Open in new window

With this configuration, you would test for Child_ID = 0 to identify the root nodes and would not need to recursively call a function.

HTH
Dale
Good day Dale,

Thanks a lot. Sorry for delays. Working on it (without result though...yet). Have a nice week-end. Reverting...