1个回答
展开全部
Private Sub Form_Load()
Dim i As Integer
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("SELECT * FROM 表1;") '以要链接的表建立记录集
If rst.RecordCount = 0 Then MsgBox "表中无数据!程序终止。": Exit Sub '如果链接表无数据
i = 1
rst.MoveFirst '记录首
While Not rst.EOF '汪辩循环记录
With Me.TreeView3.Nodes '每循环1条记录添加一个分类
.Add , 4, "K" & i, "" & rst(0) & "埋陵薯"
.Add "K" & i, 4, , "" & rst(1) & ""弯者
.Add "K" & i, 4, , "" & rst(2) & ""
End With
i = i + 1
rst.MoveNext '下一条记录
Wend
End Sub
Dim i As Integer
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("SELECT * FROM 表1;") '以要链接的表建立记录集
If rst.RecordCount = 0 Then MsgBox "表中无数据!程序终止。": Exit Sub '如果链接表无数据
i = 1
rst.MoveFirst '记录首
While Not rst.EOF '汪辩循环记录
With Me.TreeView3.Nodes '每循环1条记录添加一个分类
.Add , 4, "K" & i, "" & rst(0) & "埋陵薯"
.Add "K" & i, 4, , "" & rst(1) & ""弯者
.Add "K" & i, 4, , "" & rst(2) & ""
End With
i = i + 1
rst.MoveNext '下一条记录
Wend
End Sub
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询