Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Oct 2001
    Location
    New York
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Display Digital Clock in a form (97 SR1)

    Is it possible to have a digital clock in a form (showing hour, minutes, seconds) of the current time? Similar to the type that is on the bottom of the Windows screen. If so, how do I create one?

  2. #2
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Frederick, Maryland, USA
    Posts
    296
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display Digital Clock in a form (97 SR1)

    * Open your form in Design view.
    * Open the Toolbox (select View, Toolbox from the main Access menu bar).
    * Click the Label button then click on the form to place the Label.
    * Right click on the Label and select Properties.
    * Under the Other tab of the Properties box, type Clock in the Name box. Close the Properties box.
    * On the main Access menu bar, select View, Properties.
    * Under the Event tab of the Properties box, click on the On Timer box, select Event Procedure, then press the small button with "..." on it.
    * Paste/type the following code into the Visual Basic window. Don't repeat the Private Sub and End Sub declarations if they're already shown:

    Private Sub Form_Timer()
    Clock.Caption = Format(Now(), "h:mm:ss AM/PM")
    End Sub

    * Exit Visual Basic.
    * Under the Event tab of the Properties box, type 400 in the Timer Interval box.
    * Close the Properties box.
    * Exit and, if prompted, save your form.
    * Re-start your form...the Label should be presented as a digital clock.

    Good luck!

  3. #3
    Star Lounger
    Join Date
    Dec 2001
    Location
    Fredensborg, Denmark
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display Digital Clock in a form (97 SR1)

    A combination of a textbox and a timer event for the form will do it.
    Define a textbox to hold the time.
    Use a timer event to update the time in the textbox repeatedly using your preferred timer interval.
    You will find help about timer events in Access help.

  4. #4
    Star Lounger
    Join Date
    Dec 2001
    Location
    Fredensborg, Denmark
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display Digital Clock in a form (97 SR1)

    Well, we made our replies concurrently.

    To make the proposed code sequence work as I imagine you would like it to, reset the timer interval in the timer event, e.g.:
    Me.TimerInterval = 400 ' (or whatever timerinterval you need)

  5. #5
    Lounger
    Join Date
    Oct 2001
    Location
    New York
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display Digital Clock in a form (97 SR1)

    Thanks to Both of you!

    Nadia

  6. #6
    Star Lounger
    Join Date
    Dec 2001
    Location
    Fredensborg, Denmark
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display Digital Clock in a form (97 SR1)

    Sorry, Nadia (and rhconley)!

    You don't have to reset it!

Posting Permissions

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