I am trying to create a form so that I can display a high level down to a low level in one column (ALL of Sam's reports, direct and indirect) without having to use code...I am hoping table structure alone will allow this flexibility...d oes anyone know of any existing examples I could peruse to help???
TreeView control
Collapse
X
-
Tags: None
-
Looks to me you need a self-related table like:
ID
IDofParent
FieldX
Now you can place this table e.g. 4 times and connect from the first the IDofParent to the ID of the second, the IDofParent of the second to the ID of the third, etc.
This does require a max of levels, but is doable without code.
The general approach would however bee to use a tree control, but that required advanced VBA skills....
Nic;o) -
A TreeView Control would, as Nico stated, graphically display this Hierarchal Structure on a Form and we could also keep its syntax as simple as possible. Give me a sample subset of the data with all Levels defined and I'll post the code for you. Once you see it, I'm sure that you will be able to fill in the blanks.Originally posted by computeriderI am trying to create a form so that I can display a high level down to a low level in one column (ALL of Sam's reports, direct and indirect) without having to use code...I am hoping table structure alone will allow this flexibility...d oes anyone know of any existing examples I could peruse to help???Comment
-
so if i choose a manager from the last row, i should see all individuals for all 3 lower levels in a single row, i.e.:Code:Level 1 Level 2 Level 3 Level 4 OPS SOAR Provider Service Provider Services OPS SOAR Provider Service ALL Reviews OPS SOAR Service Quality QA OPS DOES Document Operations NA OPS DOES Process Reengineering NA OPS DOES Electronic Solutions ES Support OPS DOES Electronic Solutions ES Maintenance Finance Monroe ASO ASO Customer Service Finance Monroe ASO ASO Claims Finance Monroe ASO ASO Rewards Finance Monroe PCG Customer Guarantees
Monroe + PCG + Customer Gurtantees
if I need to add further info let me know - without code this is a headache inducer...Comment
-
I will get back to you on this shortly.Originally posted by computeriderso if i choose a manager from the last row, i should see all individuals for all 3 lower levels in a single row, i.e.:Code:Level 1 Level 2 Level 3 Level 4 OPS SOAR Provider Service Provider Services OPS SOAR Provider Service ALL Reviews OPS SOAR Service Quality QA OPS DOES Document Operations NA OPS DOES Process Reengineering NA OPS DOES Electronic Solutions ES Support OPS DOES Electronic Solutions ES Maintenance Finance Monroe ASO ASO Customer Service Finance Monroe ASO ASO Claims Finance Monroe ASO ASO Rewards Finance Monroe PCG Customer Guarantees
Monroe + PCG + Customer Gurtantees
if I need to add further info let me know - without code this is a headache inducer...Comment
-
Hang on to your seat belts and follow these instructions exactly:Originally posted by ADeziiI will get back to you on this shortly.
__01 Create a New, Unbound Form.
__02 Place a TreeView Control on the Form via Insert ==> ActiveX Control ==> Microsoft TreeView Control.
__03 Size the Control to the full Form dimensions.
__04 Rename the TreeView Control to TreeView1. If it is named anything other than this, the code will not be functional.
__05 Place the following code in the Form's Load() Event (listed below).
__06 When the Form opens, you will see the Root and Level1 Nodes. You can now see your Hierarchal structure by Expanding/Collapsing (+/-) various branches to move Up and Down multiple Levels as in Windows Explorer.
__07 Each Level in the code has its own degree of indentation to make your understanding of the coding process easier so that you may adapt the code to your own specific needs.
__08 If you have any questions, feel free ask as the TreeView Control is a fairly complex Control to implement.
__09 If you are interested, you can also display Icons for each individual Node but this involves inserting an ImageList Control, assigning Icons to it, pointing the TreeView Control to it, and setting Index values for each Icon for each line of code.
Code:Private Sub Form_Load() Dim nodX As Node '1-Relative, tvwChild-Relationship, "g"-Key, "George"-Text Set nodX = TreeView1.Nodes.Add(, , , "Hierarchal Structure Example (ROOT)") 'Root of Treeview Control Set nodX = TreeView1.Nodes.Add(1, tvwChild, "Topic1", "OPS") Set nodX = TreeView1.Nodes.Add("Topic1", tvwChild, "Level2A", "SOAR") Set nodX = TreeView1.Nodes.Add("Level2A", tvwChild, "Level3A", "Provider Service") Set nodX = TreeView1.Nodes.Add("Level3A", tvwChild, "Level4A", "Provider Services") Set nodX = TreeView1.Nodes.Add("Level3A", tvwChild, "Level4B", "ALL Reviews") Set nodX = TreeView1.Nodes.Add("Level2A", tvwChild, "Level3B", "Service Quality") Set nodX = TreeView1.Nodes.Add("Level3B", tvwChild, "Level4C", "QA") Set nodX = TreeView1.Nodes.Add("Topic1", tvwChild, "Level2B", "DOES") Set nodX = TreeView1.Nodes.Add("Level2B", tvwChild, "Level3C", "Document Operations") Set nodX = TreeView1.Nodes.Add("Level3C", tvwChild, "Level4D", "NA") Set nodX = TreeView1.Nodes.Add("Level2B", tvwChild, "Level3D", "Process Engineering") Set nodX = TreeView1.Nodes.Add("Level3D", tvwChild, "Level4E", "NA") Set nodX = TreeView1.Nodes.Add("Level2B", tvwChild, "Level3E", "Electronic Solutions") Set nodX = TreeView1.Nodes.Add("Level3E", tvwChild, "Level4F", "ES Support") Set nodX = TreeView1.Nodes.Add("Level3E", tvwChild, "Level4G", "ES Maintenance") Set nodX = TreeView1.Nodes.Add(1, tvwChild, "Topic2", "Finance") Set nodX = TreeView1.Nodes.Add("Topic2", tvwChild, "Level2C", "Monroe") Set nodX = TreeView1.Nodes.Add("Level2C", tvwChild, "Level3F", "ASO") Set nodX = TreeView1.Nodes.Add("Level3F", tvwChild, "Level4H", "ASO Customer Service") Set nodX = TreeView1.Nodes.Add("Level3F", tvwChild, "Level4I", "ASO Claims") Set nodX = TreeView1.Nodes.Add("Level3F", tvwChild, "Level4J", "ASO Rewards") Set nodX = TreeView1.Nodes.Add("Level2C", tvwChild, "Level3G", "PCG") Set nodX = TreeView1.Nodes.Add("Level3G", tvwChild, "Level4K", "Customer Guarantees") nodX.EnsureVisible TreeView1.Nodes(1).ForeColor = QBColor(4) Exit_Form_Load: Exit Sub Err_Form_Load: MsgBox Err.Description, vbExclamation, "Error in TreeView_Form_Load()" Resume Exit_Form_Load End SubComment
-
WOW - I knew it wouldn’t' be easy - I follow you to a point - in your instructions I don't see anything tying the code to my table – or am I just putting the layout and table data directly in the code itself as you have done with the few examples I provided?Comment
-
This is simlpy hard-coded values to give you an idea of how this Control functions. Reading values from a Table/Recordset wopuold add complexity to the coding.Originally posted by computeriderWOW - I knew it wouldn’t' be easy - I follow you to a point - in your instructions I don't see anything tying the code to my table – or am I just putting the layout and table data directly in the code itself as you have done with the few examples I provided?Comment
-
-
hey guys, glad to see the code working, but i can't really find where is the activex control in vba. Please advise.
ThanksComment
-
Originally posted by cogaihalan123hey guys, glad to see the code working, but i can't really find where is the activex control in vba. Please advise.
Thanks- Form Design View.
- Insert.
- ActiveX Control.
- You are now in the Insert ActiveX Control Dialog Box.
- Select the Microsoft TreeView Control, version X.X.
- The TreeView Control should now exist in the Upper Left Hand corner of the Form.
Comment
-
Thanks so much. it took me a while. :D There is one more thing that i dont know if the treeview can do. For ex, if im gonna select Service Quality ( Under OPS-SOAR), will it be possible to make a button that will copy the hierachy into the following format: OPS/ SOAR/ Service Quality?
Thanks so much man. you are the manComment
-
Yes, it should be no problem. They wouold simply be Children of Parent Nodes, follow the examples.Originally posted by cogaihalanThanks so much. it took me a while. :D There is one more thing that i dont know if the treeview can do. For ex, if im gonna select Service Quality ( Under OPS-SOAR), will it be possible to make a button that will copy the hierachy into the following format: OPS/ SOAR/ Service Quality?
Thanks so much man. you are the manComment
-
Thank you, i probably didn't make myself clear enough. It is a lil bit confusing for me.
I have successfully constructed the tree, but the information that is useful for the end user if they can extract the information out of the tree and use it.
Using the treview that we have here as an example, if I want to select service quality (which is under OPS and SOAR), is there a way to extract the levels i have go through in a text string that can look something like this:
OPS/ SOAR/ Service Quality
On the same line, if I want to convert to text string just SOAR ( under OPS), it will give me OPS/SOAR ?
and hopefully the same thing will happen if i click something else in the treeview.
I dont know if this can be accomplished by using buttons and text boxes or using something else.
Please help. I really Appreciate it. you are the manComment
Comment