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

TreeView

P: n/a
Warning - long message.

Many thanks for making the A97 version of the treeview w/o activex
controls available.

I have taken it down a different path and ended up doing almost
everything differently.

It now has, built in, the ability to have 12 levels, not just 3. The
tree's recordsource table (TreeviewRS) is built based on information
in a table that has a field for each level, as follows:
1) Name of Field in table/query to use as text of treeview display
(For example, fClientName)

2) Name of table/query to find field in (1), above (For example,
qryClients)

3) Name of ID-NO unique, non-duplicates index of table in (2) (For
example, tblClients_ID)

4) Name of ID-NO Foreign index that field in (1) relates to for tree
purposes (the key of the immediately higher tree branch) (For example,
fIndustries_FK)

Yes, Virginia, no surrogate keys for my datasources. LongIntegers
only. <g>

Database information can be easily added if you want the tree to get
its information for a particular level from a table that is neither
local nor linked

Everything works fine, EXCEPT expanding and collapsing the individual
branches. I know, I know, that sounds like a lot. LOL

In other words, in its current shape, it provides for 12 levels and as
long as you never want to have the tree collapsed, it works fine.

Truth is that most of the time I work with uncollapsed trees,
especially if I have a partial field search option, such as comes
internal to access forms. (Cntl-F is your friend. Well, it is my
friend anyway.)

I'd like to get expanding and collapsing working, but I fear that I
will be beating my head against a wall because my command of SQL is
woeful. Simple stuff I can do. BOM stuff makes my head spin. I
think this is closer to the latter.

If you have gotten this far, here is what I'm trying to accomplish
(and it wouldn't surprise me to find that by writing this out, a
solution may present itself to me):

I have a single table that has all tree entries in it. That is, I
merge all the records from the various tree-branch sources into a
single file. This single file is used as a Temporary table which has
100% of the potential branches. (tblLevelsTEMP)

The actual treeview uses a different table (TreeviewRS) to populate
the tree. As long as everything in the potential branches file is
also in the treeview source, everything works (I think I'm being
redundant).

So, let's say there is a particular branch that I want to collapse.
Let's say that the branch is a level 3 branch (with 4 branches beneath
it). I want to annotate the tblLevelsTEMP table with information such
that when I re-build TreevewRS it doesn't pick up anything BELOW that
particular branch.

The posted Treeview uses a particularly unique method which relies on
specifically 3 levels and stores information in tables in ways that I
don't want to duplicate. Trust me on this, expanding the existing
structure to 12 levels would be a nightmare.

The table structure of tblLevelsTEMP has, for each branch text:

1) A sort order indicator so that the branch will find its way to the
right location, if it is usable

2) The text to display on the tree if it is used in the treeview

3) An indicator as to what level the tree is on (my example above
would be '3')

4) A unique key within this table

5) The key of the branch immediately above this one (zero if it is a
primary branch)

6) An indicator whether the branches BENEATH this branch should be
displayed or not

7) Item (3) from the above list (not this list). That is, the ID-NO
key of this branch in the table/query from which it came.

OK, with that information, can I create a query that does the
following?

Produce a recordset from tblLevelsTEMP which has all rows from
tblLevelsTEMP other than those rows where Level is higher number than
the level indicated with a "do not use any branches BENEATH this
branch" indicator.

================================================== =====

I'm leaning towards changing the structure somewhat and having the
code which attaches to the mouse-click to collapse or expand a branch

Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.