?
Solved

Access 2007 Populate TreeView

Posted on 2011-03-17
4
Medium Priority
?
915 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 800 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 1200 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

771 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