Timer event disabled after Break

Posted on 2006-05-04
Last Modified: 2008-03-03
If you break (hit Cntl+Break) in the middle of a Form Timer event procedure and Select 'End', the timer event will no longer fire until you close and reopen the form. This is unexpected to me. Can anyone explain why this happens and how to prevent it (ie how to automatically reactivate the timer).
Question by:Milewskp
    LVL 119

    Expert Comment

    by:Rey Obrero
    from VBA help

    Timer Function Example
    This example uses the Timer function to pause the application. The example also uses DoEvents to yield to other processes during the pause.

    Dim PauseTime, Start, Finish, TotalTime
    If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
        PauseTime = 5    ' Set duration.
        Start = Timer    ' Set start time.
        Do While Timer < Start + PauseTime
            DoEvents    ' Yield to other processes.
        Finish = Timer    ' Set end time.
        TotalTime = Finish - Start    ' Calculate total time.
        MsgBox "Paused for " & TotalTime & " seconds"
    End If

    LVL 1

    Author Comment

    Hi Cap,
    I'm talking about the Timer event forforms, not the Timer function.
    LVL 119

    Accepted Solution

    <the timer event will no longer fire until you close and reopen the form.>

    the timer event for the form is most likely called in the open or load event of the form
    LVL 1

    Author Comment

    Thanks cap - full points to you.

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    This isn't a frequent question on EE. I must have seen it three or four times (among several thousand questions). However, I use this trick quite often, most frequently as a delayed Current event. A form does not expose it's calculation dependenc…
    Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now