how can I get text in a control to flash?

A

Andy Ralph

Using Access 2003 on Windows XP SP3.
I want to highlight a warning on a form if Boolean field has the value "True".
I would like to get the control that displays the value to Flash on-and-off.
Any ideas?
Thanks
 
A

Arvin Meyer [MVP]

Andy Ralph said:
Using Access 2003 on Windows XP SP3.
I want to highlight a warning on a form if Boolean field has the value
"True".
I would like to get the control that displays the value to Flash
on-and-off.
Any ideas?
Thanks

Not a particularly good idea since it irritates users. Also the wrong flash
rate can trigger Epilepsy. Here's some code that will flash a label, exactly
5 times then quit. You can also use the form's Timer and set the
TimerInterval property:

Private Sub Form_Current()
Dim i As Integer
Label0.Visible = True
For i = 1 To 10
Wait (0.5)
Me.Label0.Visible = Not Me.Label0.Visible
Next i
End Sub

Public Function Wait(sngSecs As Single)
Dim sngWait As Single

' Timer is a keyword that retrieves the number of seconds
' since midnight as a single
sngWait = Timer + sngSecs
While Timer < sngWait
DoEvents
Wend
End Function
 
L

Linq Adams via AccessMonster.com

Also, Timers firing continuously have been known to cause unintended controls
to flicker and other havoc. In addition to Arvin's suggestion to having the
control flash just five times, you might consider having the background of
the control turn red if your condition is met. In this code, the textbox to
be formatted is called Strobe and the Boolean field is called YourCheckBox:

Private Sub YourCheckBox_Click()
If YourCheckBox = -1 Then
Me.Strobe.BackColor = vbRed
Else
Me.Strobe.BackColor = vbWhite
End If
End Sub

Private Sub Form_Current()
If YourCheckBox = -1 Then
Me.Strobe.BackColor = vbRed
Else
Me.Strobe.BackColor = vbWhite
End If
End Sub
 
Top