TreeView Code

PC User

Registered User.
Local time
Yesterday, 20:41
Joined
Jul 28, 2002
Messages
193
This is the first time I've tried to work with a treeview control and it's very challenging. I've developed the branch building code in the form's module to a point where I'm confused on how to proceed. I've attached the database and a "readme" file to this posting. I hope someone can help me.

Thanks,
PC
 

Attachments

Last edited:
There are no forms or modules in your database. There is no text in your readme file. :confused:
 
The readme file explains that all objects are hidden and how to access them. This db is a prototype to import into my project after I get it working. When the prototype is utilized in my project the objects will remain hidden. I've done more work on the db and its now too large to upload. Thanks for your reply.

PC
 
I've resolved the problem with displaying the Discription when the user doubleclicks on one of the branchs.

Code:
Private Sub tvHelpTree_NodeClick(ByVal nodTreeView As Object)

    Dim RecordtoSelect As Long
    Dim strTopic As String
    Dim strDiscription As String
    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Set db = CurrentDb()
 
Me.txtSelectedKey = nodTreeView.Key

    Select Case Left(nodTreeView.Key, 1)

        Case "x"
            Exit Sub
        
        Case "A"
            Set rst = db.OpenRecordset("usysHelpLevel1", dbOpenDynaset)
            RecordtoSelect = Right(nodTreeView.Key, 1)
            rst.FindFirst "Level1ID = " & RecordtoSelect
            Me!txtTopic = rst!Topic1
            Me.rtfHelp = Nz(rst!Discription1, "")
            rst.Close
            Exit Sub
        
        Case "B"
            Set rst = db.OpenRecordset("usysHelpLevel2", dbOpenDynaset)
            RecordtoSelect = Right(nodTreeView.Key, 1)

            If Len(nodTreeView.Key) < 3 Then
                strTopic = Nz(DLookup("Topic2", "usysHelpLevel2", "[Level2ID] = " & Right(nodTreeView.Key, 1)), "")
                Me!txtTopic = strTopic
                strDiscription = Nz(DLookup("Discription2", "usysHelpLevel2", "[Level2ID] = " & Right(nodTreeView.Key, 1)), "")
                Me.rtfHelp = Nz(strDiscription, "")
                Me!txtKeyCode = Right(nodTreeView.Key, 1)
            Else
                strTopic = Nz(DLookup("Topic2", "usysHelpLevel2", "[Level2ID] = " & Right(nodTreeView.Key, 2)), "")
                Me!txtTopic = strTopic
                strDiscription = Nz(DLookup("Discription2", "usysHelpLevel2", "[Level2ID] = " & Right(nodTreeView.Key, 2)), "")
                Me.rtfHelp = Nz(strDiscription, "")
                Me!txtKeyCode = Right(nodTreeView.Key, 2)
            End If
            
            rst.Close
            Exit Sub
            
    End Select
    
End Sub
 

Users who are viewing this thread

Back
Top Bottom