Table of contents

ToggleButton.DisplayWhen 属性 (访问)ToggleButton.DisplayWhen Property (Access)

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

可以使用何时显示属性来指定要显示在屏幕上和打印窗体的控件中的哪。读取/写入字节You can use the DisplayWhen property to specify which of a form's controls you want displayed on screen and in print. Read/write Byte.


表达式DisplayWhenexpression. DisplayWhen

表达式_一个表示一个切换按钮对象的变量。_expression A variable that represents a ToggleButton object.


DisplayWhen属性仅应用于下列窗体节: 主体、 窗体页眉和窗体页脚。它还适用于窗体上的所有控件 (除了分页符)。The DisplayWhen property applies only to the following form sections: detail, form header, and form footer. It also applies to all controls (except page breaks) on a form.

DisplayWhen属性使用以下设置。The DisplayWhen property uses the following settings.

设置SettingVisual BasicVisual Basic说明Description
两者都显示Always00(默认值)对象在“窗体”视图中显示,也在打印时显示。(Default) The object appears in Form view and when printed.
只打印显示Print Only11对象在“窗体”视图中隐藏,但在打印时显示。The object is hidden in Form view but appears when printed.
只屏幕显示Screen Only22对象在“窗体”视图中显示,但在打印时不显示。The object appears in Form view but not when printed.

对于控件,可以在 Visual Basic 中使用的默认控件样式或DefaultControl属性来设置此属性的默认值。For controls, you can set the default for this property by using the default control style or the DefaultControl property in Visual Basic.

在许多情况下,某些控件可仅在窗体视图中。若要防止 Microsoft Access 打印这些控件,您可以设置为仅在屏幕的何时显示属性。例如,可能您不想打印窗体上有命令按钮或指令。或者,您可能具有窗体页眉和窗体页脚节,您不希望在屏幕上显示,但却要打印出来。在这种情况下,应将何时显示属性设置为仅在打印。In many cases, certain controls are useful only in Form view. To prevent Microsoft Access from printing these controls, you can set their DisplayWhen property to Screen Only. For example, you might have a command button or instructions on a form that you don't want printed. Or you might have form header and form footer sections that you don't want displayed on screen but that you do want printed. In this case, you should set the DisplayWhen property to Print Only.

对于报表,使用的格式撤回事件指定事件过程或宏,如果不想打印控件的可见属性设置。您还可以取消格式或打印报表节以防止明正在打印事件。For reports, use the Format and Retreat events to specify an event procedure or macro that sets the Visible property of controls you don't want printed. You can also cancel the Format or Print event for a report section to prevent the section from being printed.

另请参阅See also


切换按钮对象ToggleButton Object

© 2018 Microsoft