Question Help with link parent/child node to a control on main form in Treeview

josephbupe

Registered User.
Local time
Today, 20:23
Joined
Jan 31, 2008
Messages
247
Hi,

I downloaded a sample treeview application I have modified most of its to suit my need, except one thing. I want link parent/child node the main form to the main form through a subform on the CategoryID.

The following is the original code where when a child not is clicked only pops up a "linked" msgbox. I need to modify the part of the code on the Select Case "C" in red:

Code:
'----------------------------
Sub DisplayForm(i As Integer)
'----------------------------

   ' for this Treeview I do not want a double-click on a parent node
   ' to open the applicable Category form, but pressing the shift key
   ' should open the marriage form applicable to the parent node.  Shift
   ' or double-click on a child node should open the applicable
   ' offence form.
   
   Dim strKey As String
   Dim strTag As String
   Dim strFilter As String
   
   ' get key of selected node
   strKey = Me.myTreeView.SelectedItem.Key
   ' .. then get node's tag proterty
   strTag = Nz(Me.myTreeView.Nodes(strKey).Tag, "")
   
   ' .. then if there is a tag value
   If Len(strTag) > 0 Then
   
      '.. then get the initial letter of node key
      Select Case Left(strKey, 1)
      
         ' .. and open the the appropriate form filter by tag value
         Case "A"
            
            ' if parent node then a double-click expands node
            ' but does not open Category form
            If i = 2 Then Exit Sub
            strFilter = "DoCmd.OpenForm ""F_Category"", , , " & _
                        "RecordNo = """ & strTag & """"
         'Case "C"
          [COLOR=Red]  strFilter = "DoCmd.OpenForm ""F_OFFENCE"", , , " & _
                       "OffenceID = """ & strTag & """"         [/COLOR]
                
        End Select
      
      ' not for real here, so just display what would happen
      MsgBox strFilter
   End If
End Sub

I will appreciate your help.

Joseph
 

Users who are viewing this thread

Back
Top Bottom