Solved

Access 2007 Populate TreeView

Posted on 2011-03-17
4
909 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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