艾好者 发表于:2020-04-02 16:39:30
Private Sub Fillbtns()
'显示切换框中的列表
'按钮数量
Const conNumButtons As Integer = 4
Dim rs As New ADODB.Recordset
Dim strSQL As String
Dim intbtn As Integer
Me![button1].SetFocus
For intbtn = 2 To conNumButtons
Me("button" & intbtn).Visible = False
Me("btn" & intbtn).Visible = False
Next intbtn
'打开表Switchboard Items
strSQL = "SELECT * FROM [Switchboard Items]"
strSQL = strSQL & " WHERE [ItemNumber] > 0 AND [SwitchboardID]= " & Me.switchboardID
strSQL = strSQL & " ORDER BY [Itemnumber];"
Set rs = GetRS(strSQL)
If (rs.EOF) Then
Me![btn1].Caption = "此切换面板页上无项目。"
Else
While (Not (rs.EOF))
Me("button" & rs![ItemNumber]).Visible = True
Me("btn" & rs![ItemNumber]).Visible = True
Me("btn" & rs![ItemNumber]).Caption = rs![ItemText]
rs.MoveNext
Wend
End If
'关闭数据集合和数据库
rs.Close
Set rs = Nothing
End Sub
焦点从主窗体到子窗体,还要有一句:
DoCmd.GoToControl "子窗体名称"
总记录:1篇 页次:1/1 9 1 :