I can not seem to figure this out, can someone assist please.
I have a userfrom in excel that has a treeview, I am trying to populate the treeview with a recordset from ms sql using ADO.
I have managed to populate the Parent Nodes but have not been able to figure out how to populate the child nodes. Everything with the connection to the database and getting a recordset returned seems to be working as I do get the parent nodes to populate.
I am a rookie in vba and have been able to eventually figure things out with google and youtube, but I am stuck on this one...cant find much online related to what I am trying to do.
I have tried the following code and I get a error " Error number = 2147257114 Invalid object"
This is the first time I have tried using treeview.
All assistance would be greatly appreciated.
I have a userfrom in excel that has a treeview, I am trying to populate the treeview with a recordset from ms sql using ADO.
I have managed to populate the Parent Nodes but have not been able to figure out how to populate the child nodes. Everything with the connection to the database and getting a recordset returned seems to be working as I do get the parent nodes to populate.
I am a rookie in vba and have been able to eventually figure things out with google and youtube, but I am stuck on this one...cant find much online related to what I am trying to do.
I have tried the following code and I get a error " Error number = 2147257114 Invalid object"
This is the first time I have tried using treeview.
All assistance would be greatly appreciated.
VBA Code:
Me.TreeView1.Nodes.Clear
'load Treeview
Do While Not rs.EOF
Me.TreeView1.Nodes.Add = rs.Fields.Item("BidItemNo")
Me.TreeView1.Nodes.Add rs.Fields.Item("BidItemNo"), tvwChild, rs.Fields.Item("BidItemDescription"), rs.Fields.Item("BidItemDescription")
rs.MoveNext
Loop