Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56

    Question Unanswered: Countdown timer on form?

    Hey Guys,

    I've searched the Forum for this and can't find anything to help what seems to be a simple thing that is eluding me at the moment (that Monday feeling again).

    I need a timer to be displayed on a pop-up form that counts down from 3 seconds to 0 (at 1 second intervals obviously). Is it using an unbound textbox and code on the OnOpen event of the form?

    Rusty

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    The only way I know how is to call the windows API function timeGetTime in winmm.dll- not something for the faint hearted. It can be done, but I wouldn't tackle it from scratch.

    Unfortunately I have no non copyrighted code available to release so you'll just have to investigate or go buy a book
    Last edited by healdem; 12-06-04 at 11:56.

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Rusty's Way
    Hey Guys,

    I've searched the Forum for this and can't find anything to help what seems to be a simple thing that is eluding me at the moment (that Monday feeling again).

    I need a timer to be displayed on a pop-up form that counts down from 3 seconds to 0 (at 1 second intervals obviously). Is it using an unbound textbox and code on the OnOpen event of the form?

    Rusty
    And your question is??? Can it be done? Yes.
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56
    Thanks for the help healdem.

    I did it using the unbound textbox idea and set the value to 3 in the OnOpen event of the form:

    Private Sub Form_Open(Cancel As Integer)
    Me.txtTimer.value = 3
    End Sub


    I set the TimerInterval to 1000 and in the OnTimer event I put his code:

    Private Sub Form_Timer()
    Me.txtTimer.value = Me.txtTimer.value - 1

    If Me.txtTimer.value = 0 Then
    Application.Quit
    Else
    End If
    End Sub

    This runs on a pop up form that now states:
    "You have been temporarily removed from the database by the administrator."
    "MS Access will close in" ... "seconds"

    Simple but effective.

    Rusty
    Last edited by Rusty's Way; 12-06-04 at 13:24.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •