Full Version: Is There Easy Way To Add Many Timer To One Form
UtterAccess Forums > Microsoft® Access > Access Forms
access2009eg
Friends;
Is there easy way to add many timer to one form
hat_tip.gif
theDBguy
Hi,
That do you mean? Each form only has one timer event.
Just my 2 cents... 2cents.gif
BananaRepublic
Not easily. You only have one TimerInterval. Therefore, you would need to set it to the smallest unit possible, then test how much time has lapsed then determine which action need to be performed.
CyberCow
Based on what little information is provided, I would use subforms, each with their own timer settings. It all depends on what relationships exist between the frequency(s) of each timer event. If there is a mathematical relationship (evenly divisible) between the timer event(s), you could use code to divide/multiply the timer events that need to occur.
Can you provide a detailed description of what you are trying to accomplish?
access2009eg
friends
Thanks
eaxmple of what i want
(1) Make Clock on the form using label every second
+
(2) change the color of any label every 6 seconds
thanks
theDBguy
Hi,
So, assuming you already have a timer to change the label every second, then all you really need is the color change every six seconds. For that, you can try adding something like this to your code:
If DatePart("s", Now()) MOD 6 = 0 Then
Me.LabelName.BackColor = vbRed
End If
Just my 2 cents... 2cents.gif
CyberCow
Try:
On the Timer value, enter "1000" (no quotes).
In the OnTimer event use this procedure: (pretty much like what theDBguy said)
CODE
Me.NameOfClockLabel.Caption = Now()
If DatePart("s", Now()) Mod 6 = 0 Then
Me.NameOfYourLabel.BackColor = vbRed
End If

hope this helps
access2009eg
friends;
thanks for the help and answer
another question
if i want to make back color of any text box flash between red and yellow using timer how can i do that
CyberCow
Try . . .
CODE
Me.NameOfClockLabel.Caption = Now()
If DatePart("s", Now()) Mod 6 = 0 Then
    Me.NameOfYourLabel.BackColor = vbRed
    Me.NameOfYourTextboxControl.BackColor = vbRed
  Else
    Me.NameOfYourTextboxControl.BackColor = vbYellow
End If

If you want a different interval/frequency, just add a new If statement appropriately.
hope this helps
theDBguy
Hi,
Actually, you might want to think twice about doing something like that because it could become annoying for the user. Also, flashing screens could trigger an episode for certain people with particular ailments.
Just my 2 cents... 2cents.gif
CyberCow
theDBguy - good catch on the visual promiscuity potential. Every 6 seconds should be slow enough to fall outside such triggering mechanisms, however, I'm not a physician, but I watch them on TV big_grin.gif
BananaRepublic
I don't have the condition and it still makes me go twitch.
lease, don't do it. There are better ways to get people's attention than flashing things in their eyes. The only thing allowed to flash is old software from 80s.
missinglinq
I'd suggest thinking it over five or six times! It's not only apt to be annoying, and dangerous to some individuals (flashing like this has been shown to cause seizures in epileptics) but the use of the Timer event on a single Form has been known to not only cause problems on the Form in question, but can even cause problems on other Forms that are concurrently opened! Running multiple Timers concurrently simply seems like a recipe for disaster, to me. Having a single Timer running, to provide a clock on a Form that is opened 'full-screen,' will not probably create problems (although this should always be kept in mind if problems arise on such a Form) but using multiple Timers to flash Controls, etc., is simple asking for trouble. And to be honest, this kind of thing isn't very appropriate for a Database app!
TW, I was in a Happy Health Care provider, for 37 years! ohyeah.gif
Linq ;0)>
access2009eg
thanks
all myfriends for all this advice
hat_tip.gif
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.