Office中国论坛/Access中国论坛

标题: 树为什么不能显示孙级 [打印本页]

作者: laiguiyou    时间: 2010-4-20 15:40
标题: 树为什么不能显示孙级
本帖最后由 laiguiyou 于 2010-4-20 15:42 编辑

在树里,为什么月份下面无法显示订单号。
    '设置最顶级的"爷"
    '* ---------------------------
        Set nodindex = TreeView.Nodes.Add(, , "爷", " 订单查询", "k1", "k2")
        nodindex.Sorted = True
        nodindex.Expanded = True '展开树
   
    '* -----------------------------------------------------------------
    '* -----------------------------------------------------------------
    '设置第二级"父"
    '* ---------------------------
    Rec.Open "生产订单年度", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTableDirect
    For i = 0 To Rec.recordcount - 1
        Set nodindex = TreeView.Nodes.Add("爷", tvwChild, "父" & Rec.Fields("年度"), Rec.Fields("年度"), "k1", "k2")
        nodindex.Sorted = True
        Rec.MoveNext
    Next
    Rec.Close
    '设置第三级"子"
    '* ---------------------------
    Rec.Open "生产订单月份", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTableDirect
    For i = 0 To Rec.recordcount - 1
        Set nodindex = TreeView.Nodes.Add("父" & Rec.Fields("年度"), tvwChild, "子" & Rec.Fields("月份"), Rec.Fields("月份"), "k1", "k2")
        nodindex.Sorted = True
        Rec.MoveNext
    Next
    Rec.Close
   
    Set Rec = Nothing
    '
    '设置第四级"孙"
    '* ---------------------------
    Rec.Open "生产单号", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTableDirect
        For i = 0 To Rec.recordcount - 1
         Set nodindex = TreeView.Nodes.Add("子" & Rec.Fields("月份"), tvwChild, "孙" & Rec.Fields("生产单号"), Rec.Fields("生产单号"), "K1", "K2")
         nodindex.Sorted = True
            Rec.MoveNext
        Next
        Rec.Close

这句红色的代码错在哪里
。[attach]42035[/attach]
[attach]42036[/attach]
[attach]42037[/attach]
是用查询做的
作者: laiguiyou    时间: 2010-4-21 08:09
自已顶
作者: asklove    时间: 2010-4-21 09:54
本帖最后由 asklove 于 2010-4-21 09:55 编辑

'设置第四级"孙"
********
**********), Rec.Fields("生产单号"), "K1", "K2")
错在这里大写“K”,改为小写“k”就欧了
**********), Rec.Fields("生产单号"), "k1", "k2")
作者: laiguiyou    时间: 2010-4-21 10:35
是耶。粗心造成的。谢谢楼上的
作者: laiguiyou    时间: 2010-4-21 11:59
如何取得第四级中的月份。用mid(Node.key,2) 好象不行。




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