主题:关键字Me的用法,加了!号不清楚
以下是书中的代码,困扰了好几天了,求高手!(打?号的地方看不懂)
Private Sub FillOptions() '显示切换框中的列表
Const conNumButtons = 8 '按钮数量
Dim con As Object
Dim rs As Object
Dim stSql As String
Dim intOption As Integer
Me![Option1].SetFocus '[color=ff0000]????(方括号可不可以去掉)[/color]
For intOption = 2 To conNumButtons
Me("Option" & intOption).Visible = False [color=FF0000]'????这是加了括号,不明白[/color]
Me("OptionLabel" & intOption).Visible = False
Next intOption
' 打开SwitchboardItems表
Set con = Application.CurrentProject.Connection
stSql = "SELECT * FROM [SwitchboardItems]"
stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID][color=FF0000]'????[/color]
stSql = stSql & " ORDER BY [ItemNumber];"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1
If (rs.EOF) Then
Me![OptionLabel1].Caption = "此切换面板页上无项目。"
Else
While (Not (rs.EOF))
Me("Option" & rs![ItemNumber]).Visible = True
Me("OptionLabel" & rs![ItemNumber]).Visible = True
Me("OptionLabel" & rs![ItemNumber]).Caption = rs![ItemText]
rs.MoveNext
Wend
End If
' 关闭数据集合和数据库
rs.Close
Set rs = Nothing
Set con = Nothing
End Sub
Private Sub FillOptions() '显示切换框中的列表
Const conNumButtons = 8 '按钮数量
Dim con As Object
Dim rs As Object
Dim stSql As String
Dim intOption As Integer
Me![Option1].SetFocus '[color=ff0000]????(方括号可不可以去掉)[/color]
For intOption = 2 To conNumButtons
Me("Option" & intOption).Visible = False [color=FF0000]'????这是加了括号,不明白[/color]
Me("OptionLabel" & intOption).Visible = False
Next intOption
' 打开SwitchboardItems表
Set con = Application.CurrentProject.Connection
stSql = "SELECT * FROM [SwitchboardItems]"
stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID][color=FF0000]'????[/color]
stSql = stSql & " ORDER BY [ItemNumber];"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1
If (rs.EOF) Then
Me![OptionLabel1].Caption = "此切换面板页上无项目。"
Else
While (Not (rs.EOF))
Me("Option" & rs![ItemNumber]).Visible = True
Me("OptionLabel" & rs![ItemNumber]).Visible = True
Me("OptionLabel" & rs![ItemNumber]).Caption = rs![ItemText]
rs.MoveNext
Wend
End If
' 关闭数据集合和数据库
rs.Close
Set rs = Nothing
Set con = Nothing
End Sub