Painting Property Example

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

Function EnablePaint(frmName As Form,_
     ByVal SetPainting As Integer) As Integer
    frmName.Painting = SetPainting
    If SetPainting = False Then    'Form painting is turned off.
        DoCmd.Hourglass True            'Display hourglass icon.
    Else
        DoCmd.Hourglass False        'Don't hourglass display icon.
    End If
End Function