Form_Timer Event

J

Jac Tremblay

Hi,
In the Form_Load event, I set:
datStart = Now()
In the Form_Timer event, I have:
If (Now() - datStart) * 3600 > 5 Then

' Close the splash screen and open the main menu.
DoCmd.Close acForm, Me.Name, acSaveYes
DoCmd.OpenForm "frmMainMenu", acNormal
End If
I wander if that is correct if I want the splash screen to display 5
seconds. With that setting, it lasts about 2 minutes.
What should I change if I want it for 5 minutes or 5 seconds?
Thanks.
 
J

Jac Tremblay

Hi Mike,
I know that the Timer interval is in milliseconds. What I want to know is
the format of the time calculation result. I guess it is in decimal, which
means a decimal fraction of a day.
So the difference between two date/time values gives a fraction that one has
to convert in seconds or milliseconds (or whatever he needs).
Since there are 86400 seconds in a day (3600 * 24), I guess I could multiply
the result with that figure and compare it to 5000 milliseconds.
I will try that and reply later.
Thanks, you helped me think.
 
N

NuBie via AccessMonster.com

set your TimeInterval like this.

Form.TimerInterval = 5000 'fire it for five secs

settings for 5 minutes = 300000
settings for 5 secs = 5000



Jac said:
Hi Mike,
I know that the Timer interval is in milliseconds. What I want to know is
the format of the time calculation result. I guess it is in decimal, which
means a decimal fraction of a day.
So the difference between two date/time values gives a fraction that one has
to convert in seconds or milliseconds (or whatever he needs).
Since there are 86400 seconds in a day (3600 * 24), I guess I could multiply
the result with that figure and compare it to 5000 milliseconds.
I will try that and reply later.
Thanks, you helped me think.
The unit of measurement for this functon is miliseconds. 1000miliseconds = 1
second.
[quoted text clipped - 13 lines]
 
J

Jac Tremblay

Hi Mike,
I figured it out. Here is how one should code the If statement:
If (Now() - datStart) * 86400 > 5 Then
'...
That will fire after 5 seconds. If one wants 5 minutes, then he should write:
If (Now() - datStart) * 86400 > 300 Then ' That is: 5 min. * 60 sec. / min.
'...
The TimerInterval property can be set to 1000 (1 sec.), or 5000 (5 sec.), or
anything else as one wishes. That one is in milliseconds.
Thanks for your time.
That comment is for the posterity (I tried to find how to code the OnTimer
event for a while but could not find it. Next time, I will).
 
J

JimBurke via AccessMonster.com

If it's a splash screen, why do you have an if statement? Why aren't you just
setting the interval to 5000? I think that's what's kind of confusing people.
Normally a splash screen is the first thing displayed when the app starts -
you just set a timer to tell Access how long you want the splash screen
displayed and that's that. What's the purpose of the If statement? Are there
times where you don't want it displayed, or you want it displayed for a
different interval?

Jac said:
Hi Mike,
I figured it out. Here is how one should code the If statement:
If (Now() - datStart) * 86400 > 5 Then
'...
That will fire after 5 seconds. If one wants 5 minutes, then he should write:
If (Now() - datStart) * 86400 > 300 Then ' That is: 5 min. * 60 sec. / min.
'...
The TimerInterval property can be set to 1000 (1 sec.), or 5000 (5 sec.), or
anything else as one wishes. That one is in milliseconds.
Thanks for your time.
That comment is for the posterity (I tried to find how to code the OnTimer
event for a while but could not find it. Next time, I will).
The unit of measurement for this functon is miliseconds. 1000miliseconds = 1
second.
[quoted text clipped - 13 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