Table of contents
TOC
Collapse the table of content
Expand the table of content

Form.Painting Property (Access)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

You can use the Painting property to specify whether a form is repainted. Read/write Boolean.

Syntax

expression. Painting

expression A variable that represents a Form object.

Remarks

This property can be set and applies only in Form view and is unavailable in other views.

The Painting property is similar to the Echo action. However, the Painting property prevents repainting of a single form, whereas the Echo action prevents repainting of all open windows in an application.

Setting the Painting property for a form to False also prevents all controls (except subform controls) on a form from being repainted. To prevent a subform control from being repainted, you must set the Painting property for the subform to False. (Note that you set the Painting property for the subform, not the subform control.)

The Painting property is automatically set to True whenever the form gets or loses the focus. You can set this property to False while you are working on a form if you don't want to see changes to the form or to its controls. For example, if a form has a set of controls that are automatically resized when the form is resized and you don't want the user to see each individual control move, you can turn Painting off, and then move all of the controls, then turn Painting back on.

Example

The following example uses the Painting property to enable or disable form painting depending on whether the SetPainting variable is set to True or False. If form painting is turned off, Microsoft Access displays the hourglass icon while painting is turned off.

Public Sub EnablePaint(ByRef frmName As Form, _ 
 ByVal SetPainting As Integer) 

 frmName.Painting = SetPainting 

 ' Form painting is turned off. 
 If SetPainting = False Then 
 DoCmd.Hourglass True 
 Else 
 DoCmd.Hourglass False 
 End If 

End Sub

See also

Concepts

Form Object

© 2017 Microsoft