I have a TreeView control in an Access 2000 database, working from Several Related Recordsets.
It builds and works just fine.
I want to have a combo box at the top that gives a contract list.
When a contract is chosen, the Appropriate NODE (and they are all Parent Level) needs to be selected and expanded
I can get the code to determine if the NODE exists.
I can get it’s index number, but for the life of me I cannot figure out how to
a. Get the Program to select that Node Branch
b. If I could get this far GREAT, but even better would be to expand all it’s child levels.
Anyone got any ideas?
I have placed the code I got functional so far below.
Any help gratefully accepted.
Private Sub cboContract_AfterUpdate()
Dim strContract, oNode As Node, fFound As Boolean
fFound = False
If Not IsNull(cboContract) Then
‘Find the Contract in the list
strContract = cboContract
For Each oNode In tvcContracts.Nodes
If Left(oNode.Text, 8) = “Contract” And Mid(oNode.Text, 12, 6) = strContract Then
fFound = True
‘And this is where I get stuck. I tried the line below but no joy there!
oNode.Selected = True
Exit For
End If
Next
End If
If fFound = False Then
MsgBox “Cannot find that Contract No in the Tree”
End If
End Sub
The Search on the Node has to determine data from within the Nodes Text property.
The Data layout of the node is determined by user requirements.
Thanks (in advance) .