|
在form类模块中,写入下代码,出错,求助高手竹笛。
Private WithEvents Treevw As TreeView
Private Sub Form_Load()
treeLoad
Set Treevw = Me.TreeView.Object
End Sub
Private Sub treeLoad()
'* -----------------------------------------------------------------
Dim Rec As New ADODB.Recordset
Dim stRecQL As String
Dim Item As Integer
Dim i As Integer
Dim nodindex As Node
'* -----------------------------------------------------------------
'设置最顶级"
Set nodindex = TreeView.Nodes.add(, , "f0", "预算方案", "K1", "K2")
nodindex.Sorted = True
'* -----------------------------------------------------------------
'设置第二级
Rec.Open "gl_期间", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTableDirect
For i = 0 To Rec.RecordCount - 1
Set nodindex = TreeView.Nodes.add("f0", tvwChild, "qj" & Rec.Fields("期间_ID"), Rec.Fields("期间_NO"), "K1", "K2")
nodindex.Sorted = True
Rec.MoveNext
Next
Rec.Close
End Sub
Private Sub Treevw_NodeClick(ByRef Node As Object)
End Sub
|
|