2 Timer Events

burrina

Registered User.
Local time
Today, 13:47
Joined
May 10, 2014
Messages
972
Is it possible to have 2 timer events and they work if they need different TimerIntervals? One needs to be 200 and the other 1000.

One is a Marquee and the other is timed log out if correct data is not entered.
 
Is it possible to have 2 timer events and they work if they need different TimerIntervals? One needs to be 200 and the other 1000.
In two different forms/reports, Yes.
In same form/report, No.
 
Well, have one timer interval of 200 ms, and then every 5th one happens at 1000ms.

Code:
private m_count as integer

private sub form_load()
   me.timerinterval = 200
end sub

private sub form_timer()
    debug.print "This happens every 200ms"
    if m_count = 4
        m_count = 0
        debug.print "This happens every 1000ms"
    end if
    m_count = m_count + 1
end sub
Make sense?
 
Makes sense, I just can't get the correct syntax. I am trying to set a Marquee and also a timed event that closes the form if the correct data is not entered. This is a Login form.
The form does not close, it just minimizes because of constraints.

Dim Repeat As Boolean
'Declare a Form Global variable to hold the
'seconds expired since Form was opened.
Dim TimeCount As Long



'Timer Event For Marquee

If Repeat = False Then
' Me.TimerInterval = 0
'Call RefreshLinks
Repeat = True
Else
'Get first character
Dim FChar As String
FChar = Left(Me.LblMarquee.Caption, 1)
'Remove first character
Me.LblMarquee.Caption = Mid$(Me.LblMarquee.Caption, 2, Len(Me.LblMarquee.Caption) - 1)
'Put 1st character at the end of the message.
Me.LblMarquee.Caption = Me.LblMarquee.Caption + FChar
End If



TimerInterval is 200

'**************************************************************************************************
'Increment the TimerCount variable by 1
TimeCount = TimeCount + 1
'Display the current seconds remaining in the
'small Label control located in the upper right
'corner of the Form.
Me.Cnter.Caption = 30 - TimeCount
'If the Seconds Counter (TimerCount) is now equal
'to 61 seconds then Close the Password Entry Form.
If TimeCount = 31 Then
DoCmd.Quit

End If

Private Sub Form_Unload(Cancel As Integer)
'When the Form closes or is put into Design view
'then Zero the Form's TimerInteval. If you don't
'it can cause some strange things to happen.
Me.TimerInterval = 0
 
Or:
Code:
private sub form_timer()
    select case me.timerinterval
        case 200
            ... do something here for 200 ms ...
        case 1000
            ... do something here for 1000 ms ...
    end select
end sub

me.timerinterval = 0
 
I have tried several combinations and it's either or.
Thanks for the help. Since this is not a necessity and just a bell and whistle I will abandon it.

Many Thanks,
 
I have tried several combinations and it's either or.
Wasn't that what your original post was about?

Are you saying that 200 is dependable on 1000?
You can't have two independent timers spun off in their own right on one form. You can however have two timers on two different forms working in tandem. So perhaps you can initiate both timers on two forms and have them act on one form.
 
The idea was to have my scrolling marquee work and also my timed log out for the one form. Marquee scrolls at 200 and timeout is set at 1000. I have read that you can't have 2 timed events but for MOST things there are workarounds!

So your saying to have a subform on my main form?


That approach was genius. I added a subform to my login form and can now have both.

Thanks,

[SOLVED]
 
Last edited:

Users who are viewing this thread

Back
Top Bottom