Office中国论坛/Access中国论坛

标题: [分享]TreeView_BOM [打印本页]

作者: 5988143    时间: 2010-7-20 11:23
标题: [分享]TreeView_BOM
[attach]42754[/attach]

Explanatory Notes
    This sample db demonstrates extraction of complete hierarchical chain of sub-assemblies and components for the selected item. The user can select the desired item either by selection via combo box or by using the navigation buttons on the master  subform at top left, bound to the master table T_PartMaster. Fields PartName and UnitPrice are available for user interaction (i.e. editing or new entry). UnitPrice is to be entered only for base parts (items which are not meant to have any child assemblies or components)
    For the selected item, complete hierarchical chain of sub-assemblies and components gets displayed in the lower subform at right. For base parts, total quantity as well as total price are also shown in respective columns. Summary information (like maximum nesting levels, number of distinct assemblies and base parts as well as total cost of base parts needed for the selected item) gets depicted in label caption at top of this subform. For convenient analysis, the user can select any of the following styles of display, via option group below this subform:
    (a) All parts (Complete hierarchical chain).
    (b) Assemblies only - arranged as per relevant nesting level.
    (c) Assemblies only - Straight.
    (d) Base parts only - arranged as per relevant nesting level.
    (e) Base parts only - Straight.

    Simultaneously, the hierarchical chain of sub-assemblies and components gets depicted as tree view. Total cost of base parts (i.e. items which have no child assemblies or components) also gets depicted at bottom of tree view. Contents of tree view remain in step with the latest selection (out of five listed above) in option group.
    Also, there is two way synchronization between tree view and the lower subform at right. If the user selects any node in tree view, corresponding record in subform becomes the current record. Conversely, if the user navigates to any record in the subform, corresponding node in tree view assumes selected state. PartID of matching record in the subform gets highlighted in a manner  similar to the shade signifying selected node in treeview.
    As the user navigates through master subform at top left, the contents of tree view as well as the two subforms at right keep getting updated as per current selection (treating current PartID on master subform as the top item for which hierarchical chain is to be extracted).
    The upper subform at right enables the user to build new assemblies or edit the contents of existing ones. The three editable fields are: ParentPartID, PartID and Qty. Depending upon user preference, as per selection in the option group below this subform, contents of junction table get displayed in one of the following styles:
    (a) Hide all nesting levels beyond the top one. This provides the least cluttered view.
    (b) For nesting levels other than the top one, show only the assemblies (keeping base parts hidden).
    (c) Show all items - assemblies as well as base parts (base parts are items which do not have any child assemblies or components).

    Certain features as listed below have been incorporated as a help towards proper data entry or editing in the above subform:
    (a) If no data has yet been entered, default value of ParentPartID gets set as per current PartID in master subform at top left.
    (b) RowSource for ParentPartID combo box grows progressively in such a manner as to ensure continuity of hierarchical chain.
    (c) PartID can be entered only if ParentPartID for the given record has already been entered.
    (d) RowSource for PartID remains such as to prevent circular dependencies.
    (e) On entry of PartID, a super check is conducted against resultant circular dependency - if any.
    (f) Duplicates of a given combination of PartID and ParentPartID are not allowed. If the user happens to make such an entry, a friendly message is provided and the combination is not accepted.

    Note:
    (a) In table T_PartMaster, PartID is the primary key. Junction table T_ProductKits as well as transit table T_ProductChain make use of composite primary key made up of PartID and ParentPartID. (Values for PartID as well as ParentPartID are both derived from PartID of table T_PartMaster).
    (b) The sample db is designed in such a manner as to suit both data types for PartID (i.e. number or text).
    (c) PartName of top item as per master subform at top left is highlighted in distinct color. PartName of all sub-assemblies (not base parts) in the two subforms at right is highlighted in another distinct color. Corresponding nodes in tree view are highlighted in matching color.
    (d) For fetching various types of totals pertaining to current product chain, a hidden subform bound to a totals query is used. This arrangement is considered more efficient than multiple computations via functions etc.
    (e) While extracting hierarchical chain of components into transit table T_ProductChain, the process gets terminated as soon as any circular dependency is detected. This avoids the need for arbitrary limit to the number of recursive cycles for guarding against such a situation (thus eliminating any redundant recursive cycle).

Version: Access 2000 file format.
References:
    DAO 3.6
    Microsoft Windows Common Controls 6 (SP 6) - (This is file MSCCOMCTL.ocx - normally in System 32 folder of Windows directory)

   [Special Note Of Thanks to Arthur Fuller, Drew Wutka, Jim Dettman, Rocky Smolin and Shamil Salakhetdinov  (mentioned in alphabetical order) for the valuable inputs kindly provided by them in AccessD discussion group (Database Advisors)]

[attach]42753[/attach]

作者: yanwei82123300    时间: 2010-7-20 13:04
thank you sharing it
作者: duomu    时间: 2010-7-20 20:12
看看,谢谢
作者: 简    时间: 2010-7-20 22:45
功能看着眼花缭乱,可那密密的英文,喔喔喔,谁能翻译一下呢?
作者: changweiren    时间: 2010-7-20 23:01
虽然看不懂,怎能不谢谢!
作者: li08hua    时间: 2010-7-21 00:47
虽然看不懂,还是谢谢了!
作者: xuwenning    时间: 2010-7-21 08:44
谢谢分享
收藏了
作者: df    时间: 2010-7-22 22:28
虽然看不懂,怎能不谢谢!
作者: yori2007    时间: 2010-7-26 09:10
要是能把他换成中文的就好了
作者: goto2008    时间: 2010-7-26 11:40
学习
作者: 13676702599    时间: 2011-2-17 15:30
好东西。多是英文啊...
作者: szyewj    时间: 2011-5-10 23:40
虽然看不懂,怎能不谢谢
作者: huxinhua    时间: 2012-1-10 14:36
虽然看不懂,还是谢谢了!
作者: youchytan    时间: 2012-3-6 20:51
求个中文版的
作者: bridgeman    时间: 2012-6-10 14:35
看看跟我做的BOM展开有什么异同.
作者: lijiejoy    时间: 2015-4-7 16:13
可以看把?
作者: datouda    时间: 2017-7-26 15:48
先马住,理解来再来看
作者: daqianghou    时间: 2018-5-26 14:38
快看快看
作者: daqianghou    时间: 2018-5-26 14:39
快看快看
作者: daqianghou    时间: 2018-5-26 14:39
快看快看
作者: daqianghou    时间: 2018-5-26 14:40
快看快看军
作者: daqianghou    时间: 2018-5-26 14:41
快看快看
作者: daqianghou    时间: 2018-5-26 14:42
快看快看
作者: boon    时间: 2019-4-9 13:29
谢谢分享




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3