TreeView problem with Node.Parent [SOLVED]
Dear all,
There is a simple thing I want to do with a TreeView (NB Access 2000): for certain nodes I want them to expand... and expand their parent node, and grandparent node... etc. all the way up to root. Without this there is no guarantee that these nodes will be made viewable.
The code which works so far is to go:
but if, as a first step to making this a loop or recursive method, I go
... this gives an error on line 2:
"Object variable or With variable not set"
Incidentally at the start of the function here, I have gone
"Dim parentnode As Node"
Dear all,
There is a simple thing I want to do with a TreeView (NB Access 2000): for certain nodes I want them to expand... and expand their parent node, and grandparent node... etc. all the way up to root. Without this there is no guarantee that these nodes will be made viewable.
The code which works so far is to go:
Code:
If Not nodThis.Parent Is Nothing Then
nodThis.Parent.Expanded = True
If Not nodThis.Parent.Parent Is Nothing Then
nodThis.Parent.Parent.Expanded = True
If Not nodThis.Parent.Parent.Parent Is Nothing Then
nodThis.Parent.Parent.Parent.Expanded = True
End If
End If
End If
Code:
If Not nodThis.Parent Is Nothing Then
parentnode = nodThis.Parent
parentnode.Expanded = True
"Object variable or With variable not set"
Incidentally at the start of the function here, I have gone
"Dim parentnode As Node"
Last edited: