Hey!
So i have made a treeView in access 2007, and i made it successfully implement the first tier...but when i go to add children is when it gets funny...
So how the data looks, in column (field??) 1, there are part number, and in number 2 there are sub number...
so for example
Part 1 (in column 1)
.01 (in column 2)
and i need it go do its treeview thing where i see all the part numbers, then click the first one and it expands all the sub groups...
here is my code...i am not fluent in VB...but I do have a sturdy programming knowledge...
I cant really explain exactly what I am trying to do...But here is a picture of what the table i am using looks like:
*edit* ok the image didnt work...so i will try to explain it >.<
the first column has part numbers, and then there is a tier column...
So in the tree view of course 1.1 and 1.2 would be the first things you see, and then when you expand 1.1 for example, you would see .1, .2, .3..etc
Thats sort of what the layout is...so i am trying to add the second column in...if the first is empty...hope this makes sense >.<
BTW: the first sub is to insert the first nodes (1.1, 1.2) , second is for the next (.1, .2)
Thanks!
Paul
So i have made a treeView in access 2007, and i made it successfully implement the first tier...but when i go to add children is when it gets funny...
So how the data looks, in column (field??) 1, there are part number, and in number 2 there are sub number...
so for example
Part 1 (in column 1)
.01 (in column 2)
and i need it go do its treeview thing where i see all the part numbers, then click the first one and it expands all the sub groups...
here is my code...i am not fluent in VB...but I do have a sturdy programming knowledge...
I cant really explain exactly what I am trying to do...But here is a picture of what the table i am using looks like:
*edit* ok the image didnt work...so i will try to explain it >.<
the first column has part numbers, and then there is a tier column...
Code:
Part 1 Tier 1
1.1
.1
.2
.3
.4
.5
1.2
so the first 5 items are:
1.1.1 *info*
1.1.2 *Info*
1.1.3 *info*
1.1.4 *info*
1.1.5 *info*
So in the tree view of course 1.1 and 1.2 would be the first things you see, and then when you expand 1.1 for example, you would see .1, .2, .3..etc
Thats sort of what the layout is...so i am trying to add the second column in...if the first is empty...hope this makes sense >.<
BTW: the first sub is to insert the first nodes (1.1, 1.2) , second is for the next (.1, .2)
Code:
Private Sub CreatePartNodes()
Dim rst As DAO.Recordset
Set rst = CurrentDb.TableDefs!sampleSheet.OpenRecordset
' loop through the rows in the recordset
rst.MoveFirst
Do Until rst.EOF
If (rst!PartNum <> 0) Then
With Me.TreeView.Nodes.Add(Text:=rst!PartNum, _
Key:="prt=" & CStr(rst!PartNum))
.Expanded = True
End With
End If
rst.MoveNext
Loop
End Sub
Private Sub CreateTier1Nodes()
Dim rst As DAO.Recordset
Dim ptNum 'stores the current part number
Set rst = CurrentDb.TableDefs!sampleSheet.OpenRecordset
rst.MoveFirst
Do Until rst.EOF
If (rst!PartNum.Value = 0) Then
ptNum = rst!PartNum.Records(-1)
While (PartNum.Value = 0)
Me.TreeView.Nodes.Add Relationship:=tvwChild, _
Relative:="prt=" & CStr(rst!ptNum), _
Text:=rst!tier, Key:="t=" & CStr(rst!tier)
rst.MoveNext
Wend
End If
rst.MoveNext
Loop
End Sub
Paul
Last edited: