On timer event - help!!

G

Guest

I have two date fields (one for parts cover, the other for labour) which
sometimes have different dates entered.
I want them to flash red if less than today's date so therefore, if one
field was last week's date and the other is next week's, how can I get one to
flash, but not the other?

The following code works to a degree, but is linked to the 'Labour' field
and therefore the parts field won't flash unless the labour field is prior to
'Date':

Private Sub Form_Current()
If Me.[um_labto] < Date Then
Me.TimerInterval = 500
Else
Me.TimerInterval = 0
For Each ctl In Me.Form
If ctl.Tag = "flash" Then
ctl.ForeColor = vbBlack
End If
Next ctl
End If
End Sub

How can I have two codes which work independently of each other on the form
timer event?

tia
 
R

Ron2006

I would strongly suggest NOT using Flash red.

Change the background to red if you want but don't flash it. Or if you
do flash it have it fairly long between flashes.

Flashing monitors, particularly red, CAN triger en epileptic occurance
if someone is susceptable to that. And the individual may not even know
it since it may be hereditary.

Here is a link to Epilepsy Foundation that describes the problem.

http://www.epilepsyfoundation.org/answerplace/Medical/seizures/precipitants/photosensitivity.cfm

Ron
 
Joined
Jan 11, 2007
Messages
2
Reaction score
0
Use the Form_Timer() event

Place the code in the Form_Timer event instead of the Form_Current() event:

Private Sub Form_Timer()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "Flash" Then
ctl.ForeColor = IIf(ctl.ForeColor = vbBlack, vbBlue, vbBlack)
End If
Next ctl
End Sub

You can subsitute whatever colors you like for vbBlack/VbBlue. You can also adjust the flash rate by changing the Timer Intverval property of the form.

agorthog
 
G

Guest

Ron, Just got around 2 reading your post. Thanks for the info - didn't even
occur to me.
Regards,
 

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