Tree View current value

T

tom

I have created & populated a Tree View control on a form.

BUT....

How do I access the value that is currently selected? (via vba of
course).

And while I'm at it, is there an event raised when you select a node in
the Tree View control?

Thanks,

Tom
 
G

Geoff

Tom,

I'm using Access 2002 Developer. I have two versions of the TreeView control
installed on my system:

1. Microsoft TreeView Control Version 5 (SP2)
2. Microsoft TreeView Control Version 6

The following information relates to Version 6.
How do I access the value that is currently selected? (via vba of
course).

Where form (Me) contains control TreeView1, code in form's code module could
be:

Dim objTV As MSComctlLib.TreeView
Set objTV = Me.TreeView1.Object
With objTV.SelectedItem
MsgBox CStr(.Index) & " " & .Text
End With
And while I'm at it, is there an event raised when you select a node in
the Tree View control?

It appears not. There are 5 events:
On Updated
On Enter
On Exit
On Got Focus
On Lost Focus

Maybe you could grab the selected node when the Lost Focus or Exit event
fires. I don't know when the On Updated event fires.

I was unable to get help on my system for the TreeView control because its
help file, cmctl198.chm, was not installed. (Why? I have no idea.) I was
unable to find or download the help file from Microsoft. (Which was a
nuisance.)

There are a number of articles on the Microsoft website for the TreeView
control. Coding for .NET seems easier to find than coding for VBA.
Eventually, I found a page for:

MSDN
"Help & Support"
"Search the Support Knowledgebase"
"Search Product = Access"
"For = TreeView".

This listed some 26 articles for Access 97 onwards.

I hope you find what you're looking for and have better luck!

Regards
Geoff
 
M

Michael Gramelspacher

I have created & populated a Tree View control on a form.

BUT....

How do I access the value that is currently selected? (via vba of
course).

And while I'm at it, is there an event raised when you select a node in
the Tree View control?

Thanks,

Tom
For events open your database, click Crtl-G, click the Object Browser
icon, select the library MSComctlLib, scroll in the list for the class
TreeView. Click it. You will see all the events.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top