DisplayWhen Property

Applies To

Bound Object Frame Control, Chart Control, Check Box Control, Combo Box Control, Command Button Control, Form Section, Image Control, Label Control, Line Control, List Box Control, Option Button Control, Option Group Control, Rectangle Control, Subform/Subreport Control, Text Box Control, Toggle Button Control, Unbound Object Frame Control.

Description

You can use the DisplayWhen property to specify which of a Form’s sections or controls you want displayed on screen and in print.

Note The DisplayWhen property applies only to all controls (except page breaks) on a form.

Setting

The DisplayWhen property uses the following settings.

Setting Description Visual Basic
Always (Default) The object appears in Form view and when printed. 0
Print Only The object is hidden in Form view but appears when printed. 1
Screen Only The object appears in Form view but not when printed. 2


You can set this property in the object’s property sheet, a macro, or Visual Basic.

For controls, you can set this property using the control’s default control style.

Remarks

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.

Tip 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.

See Also

Enabled, Locked Properties; Visible Property (Microsoft Access).