老师:
此段代码运行到红字处出现错误,是什么原因呢?
运行时错误35601
Element not Found
代码如下 :
Private Sub Form_Load()
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(, , "爷", "销售客户", "K1", "K2")
nodindex.Sorted = True
Rec.Open "大区表", CurrentProject.Connection, adopenkeyset, adlockoptimistic, adcmdtabledirect
For i = 1 To Rec.RecordCount - 1
Set nodindex = TreeView.Nodes.Add("爷", tvwChild, "父" & Rec.Fields("大区ID"), Rec.Fields("大区名称"), "K1", "K2")
nodindex.Sorted = True
Rec.MoveNext
Next
Rec.Close
Rec.Open "省份表", CurrentProject.Connection, adopenkeyset, adlockoptimistic, adcmdtabledirect
For i = 1 To Rec.RecordCount - 1
Set nodindex = TreeView.Nodes.Add("父" & Rec.Fields("所属大区"), tvwChild, "子" & Rec.Fields("省份ID"), Rec.Fields("省份名称"), "K1", "K2")
nodindex.Sorted = True
Rec.MoveNext
Next
Rec.Close
Rec.Open "客户表", CurrentProject.Connection, adopenkeyset, adlockoptimistic, adcmdtabledirect
For i = 1 To Rec.RecordCount - 1
Set nodindex = TreeView.Nodes.Add("子" & Rec.Fields("所属省份"), tvwChild, "孙" & Rec.Fields("客户ID"), Rec.Fields("客户名称"), "K1", "K2")
nodindex.Sorted = True
Rec.MoveNext
Next
Rec.Close
End Sub