CharlesWhiteman
Registered User.
- Local time
- Today, 02:23
- Joined
- Feb 26, 2007
- Messages
- 421
Hi All, I have been following a most clear and informative article on building treeview controls. The article described, and i have successfully replicated, creating a treeview with two levels. My issue relates to adding a second, undocumented in the article, child level. The website is http://mymsaccessblog.blogspot.co.uk/2008/02/my-treeview-project-episode-two.html
My code follows which is erroring at the point in Sub CreateCustNodes:
Full Code:
My code follows which is erroring at the point in Sub CreateCustNodes:
Code:
Me.xProductTreeview.Nodes.Add Relationship:=tvwChild, _
Relative:="Cat=" & CStr(rst!AppID), _
Text:=rst!PracticeName, Key:="PracticeName=" & CStr(rst!PracticeName)
Full Code:
Code:
Option Compare Database
Private Sub CreateVendorNodes()
Dim rst As DAO.Recordset ' recordset for category data
' open the recordset for categories
Set rst = CurrentDb.TableDefs!TblVendors.OpenRecordset
' loop through the rows in the recordset
rst.MoveFirst
Do Until rst.EOF
Me.xProductTreeview.Nodes.Add Text:=rst!VendorName, _
Key:="Cat=" & CStr(rst!VendorID)
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub
Private Sub CreateAppNodes()
Dim rst As DAO.Recordset ' recordset for product data
' open the recordset for products
Set rst = CurrentDb.TableDefs!TblApps.OpenRecordset
' loop through the rows in the recordset
rst.MoveFirst
Do Until rst.EOF
Me.xProductTreeview.Nodes.Add Relationship:=tvwChild, _
Relative:="Cat=" & CStr(rst!VendorID), _
Text:=rst!AppTitle, Key:="PracticeName=" & CStr(rst!AppID)
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub
Private Sub CreateCustNodes()
Dim rst As DAO.Recordset ' recordset for product data
' open the recordset for products
Set rst = CurrentDb.QueryDefs!QryListLinkedCustToApp.OpenRecordset
' loop through the rows in the recordset
rst.MoveFirst
Do Until rst.EOF
Me.xProductTreeview.Nodes.Add Relationship:=tvwChild, _
Relative:="Cat=" & CStr(rst!AppID), _
Text:=rst!PracticeName, Key:="PracticeName=" & CStr(rst!PracticeName)
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub
Private Sub Form_Open(Cancel As Integer)
CreateVendorNodes
CreateAppNodes
CreateCustNodes
End Sub