On Timer Event

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

How do you do an OnTimer Event to change the properties of a line?

At 1 Second
DoCmd.MoveSize , 0.5 * 1440
At 2 Seconds
DoCmd.MoveSize , 1 * 1440
At 3 Seconds
DoCmd.MoveSize , 1.5 * 1440
At 4 Seconds
DoCmd.Close acForm,"Form1"
DoCmd.OpenForm"Form2"

Thanks
Any Help Appreciated.
DS
 
Declare a Static variable in the Timer event (or, if you must, you can use a
global variable) to keep track of how many times you've been in the routine.
 
DS said:
How do you do an OnTimer Event to change the properties of a line?

At 1 Second
DoCmd.MoveSize , 0.5 * 1440
At 2 Seconds
DoCmd.MoveSize , 1 * 1440
At 3 Seconds
DoCmd.MoveSize , 1.5 * 1440
At 4 Seconds
DoCmd.Close acForm,"Form1"
DoCmd.OpenForm"Form2"

Thanks
Any Help Appreciated.
DS

Set the TimerInterval to 1000 (1000 milliseconds = 1 second). In the
Timer event procedure, have a Static counter variable ...

Static intSecondsCount As Integer

increment it each time the event fires ...

intSecondsCount = intSecondsCount + 1

and check it incremented value to decide what to do:

Select Case intSecondsCount
Case 1
DoCmd.MoveSize , 0.5 * 1440
Case 2
DoCmd.MoveSize , 1 * 1440
Case 3
DoCmd.MoveSize , 1.5 * 1440
Case 4
' switch off the timer
Me.TimerInterval = 0
' close this form
DoCmd.Close acForm, Me.Name, acSaveNo
' open Form2
DoCmd.OpenForm"Form2"
Case Else
' just in case
intSecondsCount = 0
End Select

I'm not sure what exactly the "DoCmd.MoveSize" lines are going to do, or
whether they are really what you want to do, but the timing logic at
least should be as I've shown.
 
Dirk said:
Set the TimerInterval to 1000 (1000 milliseconds = 1 second). In the
Timer event procedure, have a Static counter variable ...

Static intSecondsCount As Integer

increment it each time the event fires ...

intSecondsCount = intSecondsCount + 1

and check it incremented value to decide what to do:

Select Case intSecondsCount
Case 1
DoCmd.MoveSize , 0.5 * 1440
Case 2
DoCmd.MoveSize , 1 * 1440
Case 3
DoCmd.MoveSize , 1.5 * 1440
Case 4
' switch off the timer
Me.TimerInterval = 0
' close this form
DoCmd.Close acForm, Me.Name, acSaveNo
' open Form2
DoCmd.OpenForm"Form2"
Case Else
' just in case
intSecondsCount = 0
End Select

I'm not sure what exactly the "DoCmd.MoveSize" lines are going to do, or
whether they are really what you want to do, but the timing logic at
least should be as I've shown.
Dirk, It worked like magic! I'm using a line a s aprogress bar on the
opening of a form and this is just what I needed. Thanks Once Again.
Sincerely,
DS
 
Douglas said:
Declare a Static variable in the Timer event (or, if you must, you can use a
global variable) to keep track of how many times you've been in the routine.
Thanks Doug.
DS
 
Back
Top