Results 1 to 9 of 9
  1. #1
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568

    Access expand node of tree in datasheetview

    Hi Guys,



    i have found this code in web:

    Code:
    Private Sub cmdExpandCurrentBranch_Click()
    Dim nodThis As MSComctlLib.Node, intIndex As Integer
    
    On Error Resume Next
    
        For Each nodThis In Me.xTree.Nodes ' loop through all nodes
            If nodThis.Selected = True Then
                intIndex = nodThis.index
                cmdExpandBranch nodThis 'Expand branch from selected node on
                Exit For
            End If
        Next nodThis
        Me.xTree.SetFocus
        Set Me.xTree.SelectedItem = Me.xTree.Nodes.Item(intIndex)
    
    End Sub
    
    Private Sub cmdExpandBranch(ByVal Node As MSComctlLib.Node)
        Dim i As Integer
    
        For i = Node.index To Node.Next.index - 1
            Me.xTree.Nodes.Item(i).Expanded = True
    '        Debug.Print Me.xTree.Nodes.Item(i).Text
        Next i
    
    End Sub
    This code expands all nodes in datasheetview tree.

    I would like to expand only one node for the current row in in my table (after afterupdate event).
    Did any of you have similar problem maybe ?

    Thank you for help,
    Jacek Antek

  2. #2
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Anyone?

    Jacek

  3. #3
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Personally, I have been working in Access for decades and have never encountered this terminology - nodes and trees. I haven't a clue what you are trying to do here but maybe someone else does (although you would have received a reply by now!).

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    The recognized guru of Access Treeviews is the The Smiley Coder. He has a number of videos starting here

  5. #5
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Thnak you Guys,

    orange - if i had a little time i would deep into Smiley Coder youtube.


    aytee111 - https://ibb.co/nBaTvQ

    I simply want to open first node of my Access datasheetview tree form after update event (like in the picture).

    Jacek

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Right! Post your database and we could assist you.

  7. #7
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Okey,

    this is a sample database from this topic (last post):

    https://www.accessforums.net/showthr...629#post364629

    Best Wishes
    Jacek

  8. #8
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    This has a missing reference? Compile error on MSComctlLib.Node

  9. #9
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    aytee111 you have to add MsComCtl.ocx to your library

    http://MsComCtl.ocx

    you can access it from here.

    and this article can be helpful for your version of Access:

    http://thesmileycoder.com/treeview-w...in-access2013/

    Best Wishes,
    Jacek

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access form Tree Style
    By gstylianou in forum Access
    Replies: 1
    Last Post: 05-26-2016, 02:49 AM
  2. Tree chat in Access
    By charly.csh in forum Access
    Replies: 1
    Last Post: 03-15-2016, 03:36 PM
  3. Replies: 1
    Last Post: 12-09-2011, 05:02 PM
  4. Like a Telephone Tree in MS Access 2003
    By mar_t in forum Access
    Replies: 4
    Last Post: 01-24-2011, 09:16 PM
  5. How to check if a node of a tree exists
    By weekend00 in forum Programming
    Replies: 2
    Last Post: 10-27-2010, 09:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums