Re: Make Label Flash



On Wed, 20 Dec 2006 12:24:00 -0800, CRZ
<CRZ@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I would like to know how I can make a label on a form flash if a field on
that form has text in it and not flash when the field is null?

You'll need to use the Form's Timer event. Set the Form's Timer
property to 500 (milliseconds, two flashes per second) or some other
suitable value and put code in the OnTimer event like


Private Sub Form_Timer()
If IsNull(Me.fieldname) Then
If Me.Label1.ForeColor = vbBlack Then
Me.Label1.ForeColor = vbRed
Else
Me.Label1.ForeColor = vbBlack
End If
End If
End Sub

or any other desired change (you can use the Forecolor to flash the
text, the Backcolor to flash the background of the entire textbox,
both, ...)

Note that many users find flashing objects on the screen VERY
annoying. Use this technique *SPARINGLY*. If you want to prevent null
entries into a control on a form, consider instead using the Form's
BeforeUpdate event to check the control, and post a polite message and
cancel the addition if it's not valid.

John W. Vinson[MVP]
.


Loading