Timer Event

  • Thread starter Haggr1 via AccessMonster.com
  • Start date
H

Haggr1 via AccessMonster.com

I'm trying to cause a "Command Buttom" to flash periodically using the
folowing code. It doesn't seem to work. Do you see any problems with the
code. (I found this code on this site) Thanks

Private Sub Form_Timer()
For j = 1 To 5
If Me.Command49.Caption = "Update" Then
Me.Command49.Caption = "Update"
Me.TimerInterval = 500
Else
Me.Command49.Caption = "Update"
Me.TimerInterval = 2500
End If
Next j

End Sub


End Sub
 
P

PieterLinden via AccessMonster.com

Haggr1 said:
I'm trying to cause a "Command Buttom" to flash periodically using the
folowing code. It doesn't seem to work. Do you see any problems with the
code. (I found this code on this site) Thanks

Private Sub Form_Timer()
For j = 1 To 5
If Me.Command49.Caption = "Update" Then
Me.Command49.Caption = "Update"
Me.TimerInterval = 500
Else
Me.Command49.Caption = "Update"
Me.TimerInterval = 2500
End If
Next j

End Sub

Keep flashing stuff away from epileptics... can cause seizures. Why the For
loop?: Your code should be in the On Timer event, not the Form_Timer...
 
M

Marshall Barton

Haggr1 said:
I'm trying to cause a "Command Buttom" to flash periodically using the
folowing code. It doesn't seem to work. Do you see any problems with the
code. (I found this code on this site) Thanks

Private Sub Form_Timer()
For j = 1 To 5
If Me.Command49.Caption = "Update" Then
Me.Command49.Caption = "Update"
Me.TimerInterval = 500
Else
Me.Command49.Caption = "Update"
Me.TimerInterval = 2500
End If
Next j

End Sub

What do you want to Flash? Normally, you would change the
color of the button's text:

Private Sub Form_Timer()
If Me.Command49.ForeColor = vbRed Then
Me.Command49.ForeColor = vbBlue
Else
Me.Command49.ForeColor = vbRed
End If
Next j

End Sub

When you want it to start flashing, set the form's
TimerInterval to something like 500 in some event
Me.TimerInterval = 500
and when you want it to stop flashing, set it to 0 in some
event
Me.TimerInterval = 0
Me.Command49.ForeColor = vbBlack

OTOH, flashing is generally a poor user interface mechanism
and to be avoided. Try to think of another way to get the
user's attention.
 
H

Haggr1 via AccessMonster.com

What would you suggest. I don't want to use anything they would have to
acknowledge ie: A "message box"

Marshall said:
I'm trying to cause a "Command Buttom" to flash periodically using the
folowing code. It doesn't seem to work. Do you see any problems with the
[quoted text clipped - 12 lines]

What do you want to Flash? Normally, you would change the
color of the button's text:

Private Sub Form_Timer()
If Me.Command49.ForeColor = vbRed Then
Me.Command49.ForeColor = vbBlue
Else
Me.Command49.ForeColor = vbRed
End If
Next j

End Sub

When you want it to start flashing, set the form's
TimerInterval to something like 500 in some event
Me.TimerInterval = 500
and when you want it to stop flashing, set it to 0 in some
event
Me.TimerInterval = 0
Me.Command49.ForeColor = vbBlack

OTOH, flashing is generally a poor user interface mechanism
and to be avoided. Try to think of another way to get the
user's attention.
 
M

Marshall Barton

I would first try to get away with just making the button's
caption bold with a different color.

If that isn't sufficient, I think I would at least consider
putting a rectangle control behind the button. Set it's
BackColor to a bright color and make it somewhat larger
than the button. Then just toggle the rectangle's Visible
property.

If your users really want flashing, make the blink rate as
slow as you can.
--
Marsh
MVP [MS Access]

What would you suggest. I don't want to use anything they would have to
acknowledge ie: A "message box"

Marshall said:
I'm trying to cause a "Command Buttom" to flash periodically using the
folowing code. It doesn't seem to work. Do you see any problems with the
[quoted text clipped - 12 lines]

What do you want to Flash? Normally, you would change the
color of the button's text:

Private Sub Form_Timer()
If Me.Command49.ForeColor = vbRed Then
Me.Command49.ForeColor = vbBlue
Else
Me.Command49.ForeColor = vbRed
End If
Next j

End Sub

When you want it to start flashing, set the form's
TimerInterval to something like 500 in some event
Me.TimerInterval = 500
and when you want it to stop flashing, set it to 0 in some
event
Me.TimerInterval = 0
Me.Command49.ForeColor = vbBlack

OTOH, flashing is generally a poor user interface mechanism
and to be avoided. Try to think of another way to get the
user's attention.
 
H

Haggr1 via AccessMonster.com

Man do I ever over think things Thanks

Marshall said:
I would first try to get away with just making the button's
caption bold with a different color.

If that isn't sufficient, I think I would at least consider
putting a rectangle control behind the button. Set it's
BackColor to a bright color and make it somewhat larger
than the button. Then just toggle the rectangle's Visible
property.

If your users really want flashing, make the blink rate as
slow as you can.
What would you suggest. I don't want to use anything they would have to
acknowledge ie: A "message box"
[quoted text clipped - 29 lines]
 

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