Results 1 to 2 of 2
  1. #1
    yahoo is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    4

    Refreshing formwith details of selected treview's node

    Hi there
    Every time I add a new node and run my refresh macro, the form on the right of my screen doesnt show all records for selected nodes (just function location). I used to 'cheat' and select mother node which made the other form working again. this time maybe cause of the size of the tree (~350k nodes) it doesn't work at all.




    Click image for larger version. 

Name:	Capture.PNG 
Views:	10 
Size:	20.9 KB 
ID:	9529

    thats my refresh macro below:
    Code:
    Private Sub Refreshy_Click()Dim nodSelected As MSComctlLib.Node, newNodSelected As MSComctlLib.Node
    Dim newNodSelected2 As MSComctlLib.Node ' a variable for the currently selected node
    Dim MyNode As Node, MyNode2 As Node
        
    Set nodSelected = Me.TreeView.SelectedItem ' get the currently selected node
    Me.TxtFunctionalLocation = nodSelected.Key
    aa = nodSelected.Key
    
    
    Me.TreeView.Nodes.Clear
    CreateTree_Click
    
    
    For Each MyNode2 In TreeView.Nodes ' that bit did my cheat to see all records in other form
    If (MyNode2.Key = "Shell") Then
    Set newNodSelected2 = MyNode2
    newNodSelected2.Selected = True
    newNodSelected2.Checked = True
    Exit For
    End If
    Next
    
    
    
    
    For Each MyNode In TreeView.Nodes 'expand tree to last selected node
    If (MyNode.Key = aa) Then
    Set newNodSelected = MyNode
    newNodSelected.Selected = True
    newNodSelected.Expanded = True
    TreeView.Requery
    Form.TreeLevelsSubform.Requery
    Exit For
    End If
    Next
    newNodSelected2.Selected = True
    
    
    newNodSelected.Selected = True
    newNodSelected.Expanded = True
    newNodSelected.EnsureVisible
    'newNodSelected.Expanded = True
    'Me.TxtFunctionalLocation = Mid(nodSelected.Key, 6)
    
    
    End Sub

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I don't see a refresh in there. If you are adding a record that you expect to see on your current from you need to refresh the database, not just requery

    so before your requery statement use:

    me.refresh

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

Similar Threads

  1. refreshing tables?
    By danbo in forum Access
    Replies: 1
    Last Post: 12-23-2011, 03:05 AM
  2. SubForm not refreshing
    By hawkins in forum Access
    Replies: 2
    Last Post: 08-16-2011, 04:30 PM
  3. Refreshing a subform?
    By Shag84 in forum Forms
    Replies: 4
    Last Post: 08-07-2011, 10:07 AM
  4. 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
  5. Replies: 1
    Last Post: 08-17-2010, 02:33 PM

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