Solved

Access 2007 Populate TreeView

Posted on 2011-03-17
4
910 Views
Last Modified: 2012-06-27
I need to come up with a clever way to populate a tree view.  My Data is organized like this

IDTag                                      Building              Floor                Area
PP-O2C01-01                       Operations           2nd                    East
PP-O2C01-02                       Operations           2nd                    East
PP-O2C01-03                       Operations           2nd                    West
PP-C3C04-01                       Command            3rd                     East
XF-O3C01-01                        Operations           3rd                    West

......
I am trying to create a function that I can pass in Building, Floor, Area (All boolean) and populate a treeview like this:

Command
|----3rd
       |----East
             |----PP-C3C04-01
Operations
|----2nd
|     |----East
|     |     |----PP-O2C01-02
|     |     |----PP-O2C01-01
|     |----West
|           |----PP-O2C01-03
|----3rd
|     |----West
|           |----XF-O3C01-01


I would like to make the function editable so that I can determine the level of organizing... so if I pass in just Building as True then it will only show

Command
|----PP-C3C04-01
Operations
|----PP-O2C01-02
|----PP-O2C01-01
|----PP-O2C01-03
|----XF-O3C01-01

All of the data is in [Main-Location] Field Names are IDTag, Building, Floor, Area

I will follow up with what I have so far.
0
Comment
Question by:VTKegan
  • 2
4 Comments
 
LVL 10

Author Comment

by:VTKegan
ID: 35160067
My Main issue is the Key property of each node.  I keep running into duplicate values.  I can't, for example, just assign it the Floor '2nd' because there may be a 2nd floor in multiple buildings.

So I would have to assign it BuildingName-Floor.

Since I would like to create a function with the parameters I cannot determine really the order of operations.

Because If I pass in Building only I can do that easily

but if I pass in Building and Floor, it gets tricky, but the code would be different if I passed in BUilding and Area.
0
 
LVL 30

Assisted Solution

by:SiddharthRout
SiddharthRout earned 200 total points
ID: 35163378
See if this example helps you?

http://www.freevbcode.com/ShowCode.asp?ID=7554

Sid
0
 
LVL 24

Accepted Solution

by:
Bitsqueezer earned 300 total points
ID: 35169893
Hi,

maybe the attached file is what you're searching for. It is done with a class module also using the "WithEvents" keyword so you can set all TreeView events inside the class. The advantage is that you can work with multiple TreeViews with this method without the need to code events again and again.

But the main thing is of course the FillTree function with which you can populate a TreeView based on the grouped style of your data. You can also set a level parameter so all unneeded levels are left out.

Cheers,

Christian
GroupTrees.zip
0
 
LVL 10

Author Comment

by:VTKegan
ID: 35171708
Thanks for the suggestions... I'm not going to be able to check these out on Monday.  I'll report back then.

Thanks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question