Solved

Access 2007 Populate TreeView

Posted on 2011-03-17
4
913 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

717 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