Office中国论坛/Access中国论坛

标题: [求助]Treeview双击后开启表单 [打印本页]

作者: ememem    时间: 2005-12-29 22:22
标题: [求助]Treeview双击后开启表单
拜读了一些有关TREEVIEW的讨论,研究了半天,总算对treeview有一点点初步的了解,但各位讨论及所提供的范例实在太深了,我实在不懂,我只想要能够双击之后能够开启一张表单


Private Sub Form_Load()


Dim objtree As TreeView


Dim nodx As Node


Set objtree = Me.TreeView1.Object


Set nodx = TreeView1.Nodes.Add(, , "A", "进销存作业", "k1")


nodx.Sorted = True


Set nodx = TreeView1.Nodes.Add("A", tvwChild, "B01", "基本数据维护", "k1")


nodx.Sorted = True


Set Nodex = TreeView1.Nodes.Add("A", tvwChild, "B02", "采购操作系统", "k1")


nodx.Sorted = True


Set Nodex = TreeView1.Nodes.Add("A", tvwChild, "B03", "进货操作系统", "k1")


nodx.Sorted = True


Set Nodex = TreeView1.Nodes.Add("A", tvwChild, "B04", "销货操作系统", "k1")


nodx.Sorted = True


Set nodx = TreeView1.Nodes.Add("B01", tvwChild, "C01", "客户数据维护作业", "k1")


nodx.Sorted = True


Set nodx = TreeView1.Nodes.Add("B01", tvwChild, "C02", "厂商数据维护作业", "k1")


nodx.Sorted = True


Set nodx = TreeView1.Nodes.Add("B01", tvwChild, "C03", "品号数据维护作业", "k1")


nodx.Sorted = True


End Sub


例如,我想要双击《客户数据维护作业》后,可以启动 docmd 来打开表单。谢谢!
作者: dgl999    时间: 2005-12-29 23:31
标题: 很简单
Private sub TREEVIEW1_DbClick()

msgbox me.treeview1.SelectedItem

docmd.open   ..........................

end sub

应该看得明白吧
作者: ememem    时间: 2005-12-30 05:42
太感激了,这样就可以用

select case的方式来做到了,谢谢,access真有趣!




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