BrokenBiker
ManicMechanic
- Local time
- Today, 12:28
- Joined
- Mar 22, 2006
- Messages
- 128
I am trying to modify a treeview example (from this site--Treeview 2000). The form's OnLoad event creates a recordset. I would like to use that to capture the PK (AutoNo_Emp) from the selected node, and have it populate an unbound textbox.
This is the OnLoad code:
This is the NodeClick event that is used to populate a label & textbox:
Essentially, what I'm trying to do is open a personnel form based on the current node selection. I could create a query to match a "FullName" concoction to the txtSeletectedNode, however...I don't want to create extra objects if I don't have to. Also, I've been struggling w/recordsets and am diving into treeview examples, and I would like to use this to learn a bit more.
So, if anyone has any ideas on how to help, I'm all ears!
---------------
Post edited to include link to sample treeview file
-BB
This is the OnLoad code:
Code:
Dim otved As clsTreeViewEnhDefinition
Me.Caption = Me.Caption
Set oTV = Me!axProducts.Object
Set dbs = CurrentDb()
Set rstEmployee = dbs.OpenRecordset("Select * From tbl_AlphaRoster Order by LName_Emp", dbOpenDynaset)
FillTree
Set oTVE.SetForm = Me
Set oTVE.SetTreeVewControl = Me.axProducts
Set otved = New clsTreeViewEnhDefinition
Set otved.rst = rstProduct
oTVE.AddDefinition otved
Set otved = New clsTreeViewEnhDefinition
Set otved.rst = rstEmployee
otved.strNodeType = "e"
otved.strNodeToDrop = "e"
otved.strIDField = "AutoNo_Emp"
otved.strParentIDField = "ReportsTo_Emp"
oTVE.AddDefinition otved
CommandBars("Treeview").Controls("Forward").Enabled = False
CommandBars("Treeview").Controls("Back").Enabled = False
mfEnableTimerEvent = True
Me.TimerInterval = 500
oTV.Nodes("m12").Expanded = True
This is the NodeClick event that is used to populate a label & textbox:
Code:
Dim h As New clsHistoryInfo
strCurrentNode = nSelectedNode.Key
If Not fSkipHistory Then
lngHistoryIndex = lngHistoryIndex + 1
If lngHistoryIndex <= colHistory.Count Then
colHistory.Item(lngHistoryIndex).strNode = strCurrentNode
colHistory.Item(lngHistoryIndex).strNodeText = nSelectedNode.Text
Else
h.strNode = strCurrentNode
h.strNodeText = nSelectedNode.Text
colHistory.Add h
CommandBars("Treeview").Controls("Forward").Enabled = False
End If
CommandBars("Treeview").Controls("Back").Enabled = True
SetHistoryToolTip
End If
Me.lblFullPath.Caption = nSelectedNode
Me.txtSelectedNode = nSelectedNode
Essentially, what I'm trying to do is open a personnel form based on the current node selection. I could create a query to match a "FullName" concoction to the txtSeletectedNode, however...I don't want to create extra objects if I don't have to. Also, I've been struggling w/recordsets and am diving into treeview examples, and I would like to use this to learn a bit more.
So, if anyone has any ideas on how to help, I'm all ears!
---------------
Post edited to include link to sample treeview file
-BB
Last edited: