OptionGroup.InSelection 属性 (Access)

使用 InSelection 属性可确定或指定是否在设计视图中选择窗体上的控件。 读/写 Boolean

语法

表达式InSelection

表达 一个代表 OptionGroup 对象的变量。

备注

选择控件后,其大小控点可见,用户可以调整其大小。 一次可选择多个控件。

示例

下面的函数使用 InSelection 属性确定窗体上的 strControlName 控件是否处于选中状态。

若要测试此代码,请将 IsControlSelected 函数代码粘贴到 Northwind 示例数据库中代码模块的“声明”部分,在“设计”视图中打开 “客户” 窗体,然后选择“ CompanyName” 控件。 在“调试”窗口中输入以下行。

? IsControlSelected (Forms!Customers, "CompanyName") 
 
Function IsControlSelected(frm As Form, _ 
 strControlName As String) As Boolean 
 Dim intI As Integer, ctl As Control 
 If frm.CurrentView <> 0 Then 
 ' Form is not in Design view. 
 Exit Function 
 Else 
 For intI = 0 To frm.Count - 1 
 Set ctl = frm(intI) 
 If ctl.InSelection = True Then 
 ' Is desired control selected? 
 If UCase(ctl.Name) = UCase(strControlName) Then 
 IsControlSelected = True 
 Exit Function 
 End If 
 Else 
 IsControlSelected = False 
 End If 
 Next intI 
 End If 
End Function

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。