Flashing Labels

W

Wayne

Hi

I have 6 check boxes in a form and I want their individual
labels to flash when the corresponding check box is ticked.
I have enterd the following code:

Private Sub Form_Timer()
With Me.SDNoticeOfProgress_Label
.ForeColor = (IIf(.ForeColor = vbRed, vbYellow, vbRed))
End With

With Me.PDNoticeOfProgress_Label
.ForeColor = (IIf(.ForeColor = vbRed, vbYellow, vbRed))
End With

With Me.DDNoticeOfProgressMid_Label
.ForeColor = (IIf(.ForeColor = vbRed, vbYellow, vbRed))
End With

With Me.DDNoticeOfProgressComplete_Label
.ForeColor = (IIf(.ForeColor = vbRed, vbYellow, vbRed))
End With

With Me.WDNoticeOfProgressMid_Label
.ForeColor = (IIf(.ForeColor = vbRed, vbYellow, vbRed))
End With

With Me.WDNoticeOfProgressComplete_Label
.ForeColor = (IIf(.ForeColor = vbRed, vbYellow, vbRed))
End With
End Sub

Private Sub SDNoticeOfProgress_AfterUpdate()
If Me.SDNoticeOfProgress = True Then
Me.TimerInterval = 300
Else
Me.TimerInterval = 0
Me.SDNoticeOfProgress_Label.ForeColor = vbWhite
End If
End Sub

Private Sub PDNoticeOfProgress_AfterUpdate()
If Me.PDNoticeOfProgress = True Then
Me.TimerInterval = 300
Else
Me.TimerInterval = 0
Me.PDNoticeOfProgress_Label.ForeColor = vbWhite
End If
End Sub

Private Sub DDNoticeOfProgressMid_AfterUpdate()
If Me.DDNoticeOfProgressMid = True Then
Me.TimerInterval = 300
Else
Me.TimerInterval = 0
Me.DDNoticeOfProgressMid_Label.ForeColor = vbWhite
End If
End Sub

Private Sub DDNoticeOfProgressComplete_AfterUpdate()
If Me.DDNoticeOfProgressComplete = True Then
Me.TimerInterval = 300
Else
Me.TimerInterval = 0
Me.DDNoticeOfProgressComplete_Label.ForeColor =
vbWhite
End If
End Sub

Private Sub WDNoticeOfProgressMid_AfterUpdate()
If Me.WDNoticeOfProgressMid = True Then
Me.TimerInterval = 300
Else
Me.TimerInterval = 0
Me.WDNoticeOfProgressMid_Label.ForeColor = vbWhite
End If
End Sub

Private Sub WDNoticeOfProgressComplete_AfterUpdate()
If Me.WDNoticeOfProgressComplete = True Then
Me.TimerInterval = 300
Else
Me.TimerInterval = 0
Me.WDNoticeOfProgressComplete_Label.ForeColor =
vbWhite
End If
End Sub

The problem is that when any of the check boxes are ticked
ALL of the labels flash. I dont know how to fix this.
I also need to put some code in the OnLoad or OnOpen event
of the form I think, to check for ticked check boxes. Is
that right?
 
J

Jeff Boyce

Wayne

As an aside, are YOU planning to use this? I've found very few people who
actually appreciate having their screen strobe at them...
 
A

Arvin Meyer

I once built a spreadsheet with some flashing cells for a salesman who
insisted that was what they needed. Within 2 hours the chief dispatcher, a
12 year employee, walked off the job. Within 3 hours everyone else did.
Within 3 hours 10 minutes the software was scrapped and the salesman fired.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
J

Jeff Boyce

Arvin

Sounds like a correlation ... Any chance any of those folks had ever eaten
peanut butter before? <g>

Jeff
 
W

Wayne

I will be using this.
They are all very small labels on a very crowded form, and
most of then appear on different tabs of the form so they
wont all be flashing at you at once. At the moment the
'Notice of progress' items on the form are being missed by
nearly everyone. I thought this might be a good way to make
them stand out, and only the ones that are required for a
particular stage in a project would be active at any one
time. Anyway, if I can make it work first, then I can
probably tone down the colors to make it more pleasing.

I hope you can help.
 
J

Jeff Boyce

Wayne

An alternative approach would be to have the label (or the background of the
text box containing the info) change to a color that stands out. The
"friendly harassment" you've been getting is about the use of a flashing
screen object, not about emphasis.

Generally, what you could do for emphasis is put code in a checkbox's
AfterUpdate event something like (aircode follows):
If Me!chkMyCheckbox = True Then
Me!chkMyCheckbox.BackColor = vbRed
Else
Me!chkMyCheckbox.BackColor = vbYellow
End If

You'd also want to fire this event from your form's OnCurrent event, so that
a newly loaded record would correctly display.

If you have multiple (?6) checkboxes, you might write a single procedure to
change the color and pass it the control's name, so it would know which
control to evaluate and change.
 
A

Arvin Meyer

Jeff Boyce said:
Arvin

Sounds like a correlation ... Any chance any of those folks had ever eaten
peanut butter before? <g>

I have no idea what they had eaten. The app was for a local messenger
service. The salesman was convinced that more could be done so he had the
delivery stop cell turn red if the employee called in more than 10 minutes
late, and start flashing if it was more than 15 minutes late. Within 2 hours
there was almost a dozen flashing cells. The dispatcher quit, then the
saleman started chewing out the delivery guys and they all started quiting.
By noon, management stepped in, fired the salesman, and had to give everyone
else a raise and promise it would never happen again to get them back.

My boss (now ex-boss) couldn't see beyond the $1000 he made for me writing
the atrocity. Fortunately, he didn't get sued, but he should have been.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top