[AccessD] Treeview (A2K7)

Jack and Pat drawbridgej at sympatico.ca
Wed Apr 8 07:38:38 CDT 2009


Alun,

I am using A2003. I  don't have A2007.  I just adjusted a working Treeview
to change the color of a node when clicked. It changes to red.

Here's the code - hope it's helpful.

'---------------------------------------------------------------------------
' Procedure : myTreeview_Click
' Author    : Jack
' Created   : 3/12/2009
' Purpose   : This is an event procedure that reacts to clicking on a node
'of the Treeview. It determines which type of node it is, And if it is a
'URL, it will link to it. If it is a pwd node, it will be changed to red.
'---------------------------------------------------------------------------
' Last Modified:
'
' Inputs: N/A
' Dependency: N/A
'---------------------------------------------------------------------------
'
Private Sub myTreeview_Click()
Dim nodSelected As Node
Set nodSelected = Me.myTreeview.SelectedItem
'For testing
'MsgBox "Node selected " & nodSelected.Key & "  " & nodSelected.Text
  nodSelected.Expanded = True
'if the selected item is a url the follow it, else just continue
If nodSelected.Key Like "url*" Then
  nodSelected.Expanded = False
 Application.FollowHyperlink nodSelected.Text, , True, True
ElseIf nodSelected.Key Like "pwd*" Then
  nodSelected.ForeColor = vbRed '<<<<<<<< change node color
End If

Jack
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Garraway, Alun
Sent: Wednesday, April 08, 2009 5:58 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Treeview (A2K7)

Hello,

am using a treeview in a form, everything okay so far :-)

what I'd like to do now is change the color of the node when chosen,
is that possible?

I've tried .Key.ForeColor = vbRed (in a With Node block)

But just get run time error 424 (object missing) :-(

Any ideas anyone?

TIA! :-)
alun

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list