Microsoft Access
--
Questions
--
Followers
Top Experts
Access 2010 Help with Tree View type form/report
Gurus,
I'm trying to figure out a way to represent an assembly drawing list. I'd like to do it in the form of a tree view something like this:
http://www.codeproject.com/KB/cpp/XmlTreeView/XmlTreeView.gif
The data is stored in a table that looks something like this:

I'm trying to produce a report that looks something like this:

I've experimented with making a table that just listed something like:
ParentID, ChildID but I can't get it to cascade if the tree is more than once sub branch deep.
Anyone out there done a project like this or able to offer guidance? I've experimented with the Tree View control but haven't gotten anything useful from it.
Front end is Access 2010, backend is MS SQL Express 2005.
I'm trying to figure out a way to represent an assembly drawing list. I'd like to do it in the form of a tree view something like this:
http://www.codeproject.com/KB/cpp/XmlTreeView/XmlTreeView.gif
The data is stored in a table that looks something like this:

I'm trying to produce a report that looks something like this:

I've experimented with making a table that just listed something like:
ParentID, ChildID but I can't get it to cascade if the tree is more than once sub branch deep.
Anyone out there done a project like this or able to offer guidance? I've experimented with the Tree View control but haven't gotten anything useful from it.
Front end is Access 2010, backend is MS SQL Express 2005.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
How are you deciding what records are associated with what hierarchy level?
In order to use a treeview, this must be clear.
So in your sample table you would seem to need a "Level" (or group) field...
In order to use a treeview, this must be clear.
So in your sample table you would seem to need a "Level" (or group) field...
At this point I have not used a "level" type field but rather been hoping to convince Access to check each level to see if there are any children (lines with the ParentID set to me).
Do I need another field to specify the level?
Do I need another field to specify the level?
OK, but still...
In your example how are you determining what records go in what level?
In your example how are you determining what records go in what level?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
How many levels deep might your tree go?
I don't see a parent/child relationship in your table that would define which nodes belong where in the tree. Â From the data you provided, I would have put them all on the same level. Â To do this properly, you need another field (I usually call it ParentID) and the data would look something like:
ID Â ParentID Â Â Drawing#
1 Â Â Â Â Â Â Â Â Â Â Â Â A10000
2 Â Â Â Â Â 1 Â Â Â Â Â Â A10001
3 Â Â Â Â Â 1 Â Â Â Â Â Â A10002
4 Â Â Â Â Â Â Â Â Â Â Â Â A10003
5 Â Â Â Â Â 1 Â Â Â Â Â Â A10004
6 Â Â Â Â Â 5 Â Â Â Â Â Â A10005
7 Â Â Â Â Â 5 Â Â Â Â Â Â A10006
If you want to do this in a report, the only way I know to do so would be to create a report based on the first level of your data (ParentID IS NULL). Â Then create a subreport where the Criteria is (ParentID IS NOT NULL). Â Embed that subreport in the Detail section of the main report and create a Master/Child relationship between the ID value in the main report and the ParentID in the child. Â This would get you the 2nd level. Â
Then, you would need to embed that subreport in the Detail section of the subreport again to get the next level of the "tree".
I don't see a parent/child relationship in your table that would define which nodes belong where in the tree. Â From the data you provided, I would have put them all on the same level. Â To do this properly, you need another field (I usually call it ParentID) and the data would look something like:
ID Â ParentID Â Â Drawing#
1 Â Â Â Â Â Â Â Â Â Â Â Â A10000
2 Â Â Â Â Â 1 Â Â Â Â Â Â A10001
3 Â Â Â Â Â 1 Â Â Â Â Â Â A10002
4 Â Â Â Â Â Â Â Â Â Â Â Â A10003
5 Â Â Â Â Â 1 Â Â Â Â Â Â A10004
6 Â Â Â Â Â 5 Â Â Â Â Â Â A10005
7 Â Â Â Â Â 5 Â Â Â Â Â Â A10006
If you want to do this in a report, the only way I know to do so would be to create a report based on the first level of your data (ParentID IS NULL). Â Then create a subreport where the Criteria is (ParentID IS NOT NULL). Â Embed that subreport in the Detail section of the main report and create a Master/Child relationship between the ID value in the main report and the ParentID in the child. Â This would get you the 2nd level. Â
Then, you would need to embed that subreport in the Detail section of the subreport again to get the next level of the "tree".
fyed,
Yes, that is what was confusing me as well...
I'll leave this to you as "Treviews" are not my strong point...
(I'll just monitor)
I only knew that in this case there was no way to determine what records went in what level...
Yes, that is what was confusing me as well...
I'll leave this to you as "Treviews" are not my strong point...
(I'll just monitor)
I only knew that in this case there was no way to determine what records went in what level...
Michaelj42
Tree Views seem to be the hot new design topic here lately...
Just a point that Treviews are really designed to show "top level" Hierarchy, ...they are not really designed to show all the way down to the "Detail" level (which is what you seem to be wanting)
For example, a Treeview would be best used to show data like this:
United States
  Texas
    Dallas
      Lewisville
Europe
  Spain
    Madrid
  Italy
    Rome
However, it is not well suited for data like this:
Cust107
  Cust107Order15
    Order15DetailLine1
    Order15DetailLine2
    Order15DetailLine3
  Cust107Order16
    Order16DetailLine1
    Order16DetailLine2
    Order16DetailLine3
    Order15DetailLine4
    Order15DetailLine5
...because the number of detail lines can vary greatly
(which is what you seem to be wanting to display)
For data like this, there are Access tools like:
Subdatasheets
Main/Sub Forms
Grouped Reports
...that will do a better job of displaying this "One-To-Many" type data.
Another example would be a "Select Folder" Dialog box.
Where only the *folders* are displayed (not the records inside each folder).
Make sense?
Finally as "cool" as a treeview might seem to be, they are not easy to code, and can end up being fairly complex if you need modify the *Nodes*/levels
JeffCoachman
Tree Views seem to be the hot new design topic here lately...
Just a point that Treviews are really designed to show "top level" Hierarchy, ...they are not really designed to show all the way down to the "Detail" level (which is what you seem to be wanting)
For example, a Treeview would be best used to show data like this:
United States
  Texas
    Dallas
      Lewisville
Europe
  Spain
    Madrid
  Italy
    Rome
However, it is not well suited for data like this:
Cust107
  Cust107Order15
    Order15DetailLine1
    Order15DetailLine2
    Order15DetailLine3
  Cust107Order16
    Order16DetailLine1
    Order16DetailLine2
    Order16DetailLine3
    Order15DetailLine4
    Order15DetailLine5
...because the number of detail lines can vary greatly
(which is what you seem to be wanting to display)
For data like this, there are Access tools like:
Subdatasheets
Main/Sub Forms
Grouped Reports
...that will do a better job of displaying this "One-To-Many" type data.
Another example would be a "Select Folder" Dialog box.
Where only the *folders* are displayed (not the records inside each folder).
Make sense?
Finally as "cool" as a treeview might seem to be, they are not easy to code, and can end up being fairly complex if you need modify the *Nodes*/levels
JeffCoachman

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.
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Thanks for the input guys.
Basically I just wanted some way to document and display for informational purposes the layout of various assemblies to guide the guys doing quotes as well for information to the production guys.
In my thinking, the treeview was a good way to graphically represent this, but I'm open to changing my mind :).
I was just hoping to throw the idea out there looking for some guidance on how to proceed or for ideas from those of you who know Access inside and out.
I've been looking at this guide and working through the episodes. There sure doesn't seem to be much info on these ActiveX controls, or am I just using the wrong keywords?
Basically I just wanted some way to document and display for informational purposes the layout of various assemblies to guide the guys doing quotes as well for information to the production guys.
In my thinking, the treeview was a good way to graphically represent this, but I'm open to changing my mind :).
I was just hoping to throw the idea out there looking for some guidance on how to proceed or for ideas from those of you who know Access inside and out.
I've been looking at this guide and working through the episodes. There sure doesn't seem to be much info on these ActiveX controls, or am I just using the wrong keywords?
fyed: I have seen 3-4 levels deep.
JeffCoachman: I am not insisting on using treeview, so yes, the real question is what is the best way to represent this data. This is just a low priority idea I've had for a while. I recently tried to start putting code to the idea and I got stuck :).
I also read here which seems to do pretty well what I had in mind.
I guess the answer to how do I represent the level of a particular datum is "I don't know..." ;) So far this isn't a lot more than a twinkle in my eye.
JeffCoachman: I am not insisting on using treeview, so yes, the real question is what is the best way to represent this data. This is just a low priority idea I've had for a while. I recently tried to start putting code to the idea and I got stuck :).
I also read here which seems to do pretty well what I had in mind.
I guess the answer to how do I represent the level of a particular datum is "I don't know..." ;) So far this isn't a lot more than a twinkle in my eye.
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
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.