Tree View Add-in

daisymsg

New Member
Joined
Dec 11, 2002
Messages
9
I was looking through the MS Access Form objects add-ins, and found an object called Tree View. It looks very interesting, but I couldn't figure out how to populate it. Has anyone used it? Could you give some basic instruction in populating it?

Thanks.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi daisymsg

If you open the Windows Explorer, the pane on the left is a Tree View (The Pane on the right is a List View). Tree view controls are VERY difficult to use. To populate the nodes of a treeview requires refernces to databases or other data that is cumbersome to get.

However, after saying all of that, once you get the hang of it then the Tree View control is an excellent control to use to view database tables, records etc.

The VBA help offers very little assistance with the control so it's best to go to the Internet for help. If you know someone with Visual Basic on their machine then there is a sample directory that has an example of how to use the control. It's at:

Drive:\Program Files\Microsoft Visual Studio\MSDN98\98VSa\1033\SAMPLES\VB98\Datatree

If you give me an e-mail address I'll send you the example, but you will need Visual basic 6.0 to run it (you could just have a look at the code by viewing it in NotePad).

anvil19
:eek:
 
Upvote 0
Hi Daisymsg,

Just my 2cents... I have actually used the treeview control to create the main interface for my database. Although figuring out how to get the data into the treeview was a bit tricky, once I had got it sussed I found it was quite simple.

What I find works best is the following:

You need a table which will store all the data to be shown by the treeview control. This table MUST contain the following information:

Unique ID (preferably AutoNumber) - this would be your Primary Key
Object Name (for reference only)
Object Description - will be shown on the treeview
Parent ID (top level objects will be blank) - refers to which "node" it needs to be a part of
Parent Description (optional)

and then you need to develop some way of handling the click event. The treeview object then gets populated by reading through this table twice - once for the "top level" objects, and then the child objects get added in the second scan.

As I said earlier, I've developed a Treeview menu system that my main db uses to navigate throughout the different forms etc. If you like I can let you have a copy - it might give you some idea on how it all fits together. Treeviews are an advanced tool however, so I'd not recommend using or playing with unless you were familiar with most VBA principles.

Hope this helps,

Ad
 
Upvote 0

Forum statistics

Threads
1,221,704
Messages
6,161,390
Members
451,701
Latest member
ckrings

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top