tapliner.blogg.se

Msaccess treeview
Msaccess treeview







msaccess treeview

' If the optional parameter is missing, then this is the first(non-recursive) call to this function. If rs(strChildField) = rs(strParentField) Then GoTo EH_CircularReference Sub AddTreeData(objTV As TreeView, rs As DAO.Recordset, strChildField As String, strParentField As String, strTextField As String, Optional varParentID As Variant) ' ParentID when searching the recordset for "grand-children", etc. Specifies the ID of the current record to be used as a ' varParentID Optional parameter that only gets passed for recursive calls to this function. ' rs Recordset containing the data used to populate the treeview ' Recursive function to populate a treeview control ' Call recursive function to fill in treeviewĪddTreeData tvwTree, rs, strChildField, strParentField, strTextField ' Clear any existing data out of the treeview Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset) StrSQL = "SELECT " & strChildField & ", " & strParentField & ", " & strTextField & " FROM " & strSourceName ' Open the recordset using table and fields specified in Sub parameters

msaccess treeview

Sub FillTreeView(tvwTree As Object, strSourceName As String, strChildField As String, strParentField As String, strTextField As String) ' strTextField Field containing text that will be used as node labels ' strChildField ID field for the child records ' strSourceName Name of the table or query containing the data used to populate the treeview ' Calls functions to clear and populate a treeview control MsgBox "Error " & Err.Number & ": " & Err.Description









Msaccess treeview