Microsoft Access
--
Questions
--
Followers
Top Experts
I want to start this from scratch as it will help me understand it better rather than importing a template from an example..
To start though, for the sake of this question. Just need some help getting the Tree Activex view working by itself.
Here's what I have;
Created a new form, set my Record source to my query, qryJobTracker.
Here is the syntax for the query in case it affects this;
SELECT dbo_View_JobProd.jpJobNum,
dbo_View_JobProd.jpTargetJobNum,
dbo_View_JobAsmbl.jaAssemblySeq,
dbo_View_JobAsmbl.jaPartNum,
dbo_View_JobAsmbl.jaDescription,
dbo_View_JobOper.joOprSeq,
9999 AS jmMtlSeq,
dbo_View_JobOper.joOpDesc,
dbo_View_JobOper.joCommentText
FROM (dbo_View_JobProd LEFT JOIN dbo_View_JobAsmbl ON dbo_View_JobProd.jpJobNum = dbo_View_JobAsmbl.jaJobNum) LEFT JOIN dbo_View_JobOper ON (dbo_View_JobAsmbl.jaAssemblySeq = dbo_View_JobOper.joAssemblySeq) AND (dbo_View_JobAsmbl.jaJobNum = dbo_View_JobOper.joJobNum)
WHERE (((dbo_View_JobProd.jpJobNum)=[Forms]![frmFAI]![cboJobNum])) OR (((dbo_View_JobProd.jpTargetJobNum)=[Forms]![frmFAI]![cboJobNum]))
UNION SELECT dbo_View_JobProd.jpJobNum,
dbo_View_JobProd.jpTargetJobNum,
dbo_View_JobAsmbl.jaAssemblySeq,
dbo_View_JobAsmbl.jaPartNum,
dbo_View_JobAsmbl.jaDescription,
9999,
dbo_View_JobMtl.jmMtlSeq,
dbo_View_JobMtl.jmPartNum,
dbo_View_JobMtl.jmDescription
FROM (dbo_View_JobProd LEFT JOIN dbo_View_JobAsmbl ON dbo_View_JobProd.jpJobNum = dbo_View_JobAsmbl.jaJobNum) LEFT JOIN dbo_View_JobMtl ON (dbo_View_JobAsmbl.jaAssemblySeq = dbo_View_JobMtl.jmAssemblySeq) AND (dbo_View_JobAsmbl.jaJobNum = dbo_View_JobMtl.jmJobNum)
WHERE (((dbo_View_JobProd.jpJobNum)=[Forms]![frmFAI]![cboJobNum])) OR (((dbo_View_JobProd.jpTargetJobNum)=[Forms]![frmFAI]![cboJobNum]));
I added an ActiveX control CTreeView Control into my blank form. In design view nothing appears in the ActiveX control where as in the examples It shows some example tree.
Here is how my form looks;

Here is how the example forms look;

Thanks in advance for the assistance!
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Thanks
fyed; I went through the episodes.. I focused on the actually structure of creating the tree. I managed to get two tiers setup.. The first is my Job Number which comes from a query, qryJobNums where I have the criteria set to Eval("[Forms]![frmFAI]![cb
Then I added a second node under Job which I can get working if I specify the connection to Eval("[Forms]![frmFAI]





EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
So I guess my question is, How can i filter the tree to only show me one job?
The only thing I could think of would be hiding a node (which I have never attempted).
Or you set up the first part of the process (CreateJobNodes) so that it only builds the Job node for the job you are interested in.
Now I'm trying to add a split in my tree though.. I'm thinking this might be simple and I just can't figure it out but I could be wrong:)
Basically I want to add different information under my assemblies; e.g.;
JobNum
ย ย ย Assembly1
ย ย ย ย ย ย ย ย Operations
ย ย ย ย ย ย ย ย Materials
ย ย ย Assembly2
ย ย ย ย ย ย ย ย Operations
ย ย ย ย ย ย ย ย Materials
I managed to add Operations in by itself no problem.. but I guess I need to add a node in between Assemblies and Operation that will create a split where I can add my operations under a node called operations and add materials under a node called materials..

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
set RsOuter = currentdb.openrecordset(st
while not rsOuter.Eof
ย ย Me.myTree.Nodes.Add ....
ย ย Call FirstLevel(rsOuter.SomeVal
ย ย rsOuter.movenext
Wend
rsOuter.Close
Then, in FirstLevel, I use the value that was passed to create another recordset based upon that value, and loop through all of the records in that recordset. ย And if I have another level, I call that from inside subroutine FirstLevel, and pass it whatever parameter I need to.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
I can tell you what I have so far, the CreateCategoryNodes was my attempt at creating the operation subcategory.. Didn't work though.. Although I did get it to show up at the bottom of my tree as another primary tier..?
Option Compare Database
Private Sub CreateJobNodes()
Dim rst As DAO.Recordset ' recordset for category data
' open the recordset for categories
Set rst = CurrentDb.QueryDefs!qryJobNums.OpenRecordset
' loop through the rows in the recordset
rst.MoveFirst
Do Until rst.EOF
Me.TreeJobTracker.Nodes.Add Text:=rst!jpJobNum, _
Key:=CStr(rst!jpJobNum)
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub
Private Sub CreateAssemblyNodes()
Dim rst As DAO.Recordset ' recordset for product data
' open the recordset for products
Set rst = CurrentDb.QueryDefs!qryJobAssemblies.OpenRecordset
' loop through the rows in the recordset
rst.MoveFirst
Do Until rst.EOF
Me.TreeJobTracker.Nodes.Add Relationship:=tvwChild, _
Relative:=CStr(rst!jpJobNum), _
Text:="ASM: " & rst!jaAssemblySeq & " " & rst!ParentPartNum, _
Key:=CStr(rst!jpJobNum) & CStr(rst!jaAssemblySeq)
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub
Private Sub CreateOperationNodes()
Dim rst As DAO.Recordset ' recordset for product data
' open the recordset for products
Set rst = CurrentDb.QueryDefs!qryJobOperations.OpenRecordset
' loop through the rows in the recordset
rst.MoveFirst
Do Until rst.EOF
Me.TreeJobTracker.Nodes.Add Relationship:=tvwChild, _
Relative:=CStr(rst!jpJobNum) & CStr(rst!jaAssemblySeq), _
Text:="Opr: " & rst!joOprSeq & " " & rst!jmDescription ', _
Key:=CStr(rst!jpJobNum) & CStr(rst!jaAssemblySeq)
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub
Private Sub CreateCategoryNodes()
Me.TreeJobTracker.Nodes.Add _
Relationship:=tvwChild, _
Relative:=CStr(rst!jpJobNum) & CStr(rst!jaAssemblySeq), _
Text:="Operations", _
Key:="Operations"
End Sub
Private Sub Form_Open(Cancel As Integer)
CreateJobNodes
CreateAssemblyNodes
CreateOperationNodes
CreateCategoryNodes
End Sub
Personally, I like the tree-view, but it can be annoying and time consuming to build, and they tend to take up a lot of screen realestate. Thank God for tabs.
Thank you all for your help!

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Microsoft Access
--
Questions
--
Followers
Top Experts
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.