A.D.Tejpal
adtp at airtelmail.in
Thu Oct 1 13:42:47 CDT 2009
Arthur, My sincere thanks. So nice of you. Your article and Drew's posts have been of great help. If I understand it correctly, the functionality desired by you, i.e. depiction of more than one child under a given grand parent in treeview, is already available in the sample db. In employees treeview, department nodes (e.g Finance / Sales) are the root nodes (i.e. grand parents), each having one child as per existing sample data, acting as a departmental head. However, there is no problem in creating more than one department head (say Vice-President 1 & 2). It can be done in three alternative ways as follows: 1 - Drag the desired employee node to the department node. That employee will become direct child to the department node and become one of the top level heads in that department, at par with existing ones. As soon as such a drag / drop is completed, modified hierarchical set up gets displayed in treeview as well as adjacent subform, with the revised chain of command duly highlighted in both. 2 - In the subform, on the record pertaining to given employee, simply clear the existing entry in ReportsTo column. It will have the same effect as that outlined in para 1 above. 3 - Enter a new record, leaving the Reports to column blank and filling in the desired department. The freshly entered employee will become a direct child of pertinent department's node (which is a root node), in addition to any other such children - if existing. Note: (a) If desired an employee can be dragged over to a department other than to which he currently belongs. (b) If an employee is dragged to an empty space within the treeview, a new department will get created (the user will be prompted for the name of new department) and the said employee's node will become direct child of the new department node. (c) There is no limit to the nested levels of hierarchy that can be depicted on employees treeview. You might like to confirm whether the features outlined above are in line with what you had in mind. Best wishes, A.D. Tejpal ------------ ----- Original Message ----- From: Arthur Fuller To: Access Developers discussion and problem solving Sent: Thursday, October 01, 2009 19:57 Subject: Re: [AccessD] treeview control Hi A.D. I've looked over your sample treeview app and it's definitely nicer than my own. I'm wondering how one might handle a slightly different requirement. Grandparent, parent and child are straightforward, but what if the Grandparent has more than one child? For example, suppose that the Grandparent is called Customers, and has two children, called Orders and Payments. Perhaps not the greatest example, but with luck you will get the general idea... GP: P1 P2 Pn Perhaps a better example would be a Customer who has several types of purchases, including Flight, EventTicket and HotelRoom. I would want each of these to be displayed in a separate node within the treeview. In all cases, there might be multiple entries. TIA, Arthur On Wed, Sep 30, 2009 at 8:31 AM, A.D.Tejpal <adtp at airtelmail.in> wrote: > Dale, > > My sample db named Form_Treeview might be of interest to you. It is > available at Rogers Access Library. Link - > http://www.rogersaccesslibrary.com/forum/forum_topics.asp?FID=45 > > This sample is in Access 2000 file format and works on Access 2007 as > well. It demonstrates two styles of treeview, one represents employees > organization chart, while the other facilitates marking of student grades in > a convenient manner. > > In both cases, there is two way synchronization between the treeview and > adjacent subform, for navigation and editing. > > An interesting feature has been incorporated in employees version. > Whichever happens to be the current employee, complete chain of command is > highlighted. The employee and his top boss are shown in two different colors > while all intermediate supervisors in direct chain of command are shown in > another color. This highlighting gets implemented on the treeview as well as > subform in identical style. > > If an employee node is dragged over to another employee or department, > the resulting modified structure gets displayed on the treeview as well as > subform, duly highlighting the revised chain of command in the manner > described in previous para. > > Note: > This is a fresh sample db and as mentioned at the end of explanatory > notes accompanying the sample, Drew's wonderful series of posts on treeview > control, and Arthur's excellent article on the subject (in DatabaseAdvisors) > have been of great help. > > Best wishes, > A.D. Tejpal > ------------