![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Here is a code snippet that I use to populate a treeview control: Do Until rst.NoMatch * * * * *' Extract the category name an count of related products * * * * *strText = rst![catname] & " - " & DCount("id", "PRODUCTS", "catid = " & rst![id]) * * * * *' Add as a child node to the tree. * * * * *Set nodCurrent = objTree.Nodes.Add(nodParent, tvwChild, "a" & _ * * * * * * rst!id, strText) * * * * *' Save your place in the recordset. * * * * *bk = rst.Bookmark * * * * *' Add any subcategories. * * * * *AddChildren nodCurrent, rst * * * * *' Return to your place in the recordset and continue to search. * * * * *rst.Bookmark = bk * * * * *' Find the next subcategory. * * * * *rst.FindNext "[parentid]=" & Mid(nodParent.Key, 2) * * * Loop You can see I use DCount to find how many products are in the category and then display it next to the category name in the treeview. If I change the [catid] of a product I would like to use the AfterUpdate event to update the counts on my treeview. Any ideas on how to do this? |
![]() |
| Thread Tools | |
| Display Modes | |
| |