tree view control (1 Viewer)

conception_native_0123

Well-known member
Local time
Today, 12:40
Joined
Mar 13, 2021
Messages
1,852
hey you guys,

does anyone have an example of code that executes when a tree view control line item is pressed? I don't do this work anymore, but I have an example of a treeview that is used from someone else and I've been asked if there are any examples out there of treeview controls that have code runnning behind them. see example below of what I have found inside of access. thanks. even though the treeview control that I snapped an image of below has a "1" on the end, the example I was given has an OLE class of "2".

1.jpg


2.jpg


3.jpg
 

June7

AWF VIP
Local time
Today, 09:40
Joined
Mar 9, 2014
Messages
5,490
Example at http://azlihassan.com/apps/articles/visual-basic-for-applications-vba/populating-treeview-control. Can download file.
I found another sample that is much simpler and adapted it. Even though there is no such event showing in Property Sheet, it does execute.
Code:
Private Sub TreeView0_NodeClick(ByVal node As Object)
   'User clicked a node
    Select Case node.key
       Case "X2"
          DoCmd.OpenReport "test", acViewPreview
       Case Else
          MsgBox "Node clicked in treeview: " & node.key
    End Select
End Sub
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Today, 13:40
Joined
May 21, 2018
Messages
8,555

I have probably posted more on treeviews and Access than anything you can find on the internet. I demo node click events. My class module is better than anything else out there for simplifying treeviews.
 

Users who are viewing this thread

Top Bottom