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 ctl As Controlrem 定义一个控件类型变量
DoCmd.OpenForm "窗体12", acDesign, , , , acHidden
rem 在设计视图以隐藏状态打开窗体12
Set ctl = CreateControl("窗体12", acComboBox, acDetail, , , 10, 50, 3000, 440)
创建控件ctl在窗体12中,类型为组合框,后面为具体选项
DoCmd.OpenForm "窗体12"
执行显示窗体。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)