I have defined a public object variable in a form:
Public TV As Object
A button opens another form containing a treeview object. The user picks items in the treeview and then closes the form. When the form closes I set the public object variable to be the treeview object in the closing form:
Private Sub Form_Close()
set Forms("XYZ"
.TV = Me.Treeview
msgbox Forms("XYZ"
.TV.Nodes.Count
End Sub
The operation appears to work because it correctly tells me the node count. However, once the treeview form is closed the TV object becomes empty. Can anyone explain why this is the case and how I can properly set the TV object so I can use it in the original (ie. "XYZ"
form?
I tried creating a public procedure in the original form and calling it from the Form_Close procedure in the treeview form but it gave the same result.
Public Sub setTV(ByVal updatedTV As Object)
Set TV = updatedTV
MsgBox TV.Nodes.Count
End Sub
Public TV As Object
A button opens another form containing a treeview object. The user picks items in the treeview and then closes the form. When the form closes I set the public object variable to be the treeview object in the closing form:
Private Sub Form_Close()
set Forms("XYZ"
msgbox Forms("XYZ"
End Sub
The operation appears to work because it correctly tells me the node count. However, once the treeview form is closed the TV object becomes empty. Can anyone explain why this is the case and how I can properly set the TV object so I can use it in the original (ie. "XYZ"
I tried creating a public procedure in the original form and calling it from the Form_Close procedure in the treeview form but it gave the same result.
Public Sub setTV(ByVal updatedTV As Object)
Set TV = updatedTV
MsgBox TV.Nodes.Count
End Sub