Flashing Textbox/Label when Time Expires...

Graham T

Registered User.
Local time
Today, 22:39
Joined
Mar 14, 2001
Messages
300
If I have a Text Box containing Time Out (txtTimeOut - ShortTime format), can I have this flash if the value in time out is Less Than the Current Time.

This should be so the user can visually see that the time has expired and the record will need to be updated.

I know how to make a label flash, but can't quite work out how to compare the time value against the current system time.

By the way, I am not a fan of flashing labels, but that is what the user wants !!

TIA

Graham
 
Basically, you need to know about two things. I will tell you the topics in Help and discuss how I approach the issue for something totally different in purpose but similar in effect.

First, you need to read up on Form_Timer events, then look up the Form.TimerInterval property to see how these two interact. Also look up DateAdd, Form_Close, and Form_AfterUpdate.

Next, you need to define some things in the class module of the form to support the code effect you want.

The way I do mine is to store a date variable in the declarations section of the class module. Then once per minute, I have the form timer event routine compare Now() to the date variable. The first time that Now() becomes greater than the stored date/time value, you change the timer from a slow rate to a faster rate. Then you play with your label's .ForeColor and .BackColor properties.

I keep a separate state variable handy so I can use it to define whether I'm in countdown mode or flash mode. Just convert this from one mode to the other using the Not operator, or something equally simple.

Put something in the Form_AfterUpdate routine to reset the timer to the long interval and reset the stored future date. You can generate this date with a DateAdd function. Take Now() and add some number of minutes to it. Store the result in your aforementioned date variable.

One more thing... when the form is about to close, reset the timer interval to 0. That's the Form_Close event.
 
Thanks Doc_Man

I will look into this to see what I can do.

Graham
 

Users who are viewing this thread

Back
Top Bottom