Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2005
    Location
    Somewhere on the 3rd Rock
    Posts
    93

    Unhappy Unanswered: Adding a working Clock to a Form

    I was tring to add a working clock on a form, I was using the following guidelines.

    put a simple text clock on a form, create a Label called lblClock on the form, set the form's TimerInterval to 1000, and the following code behind the Timer Event.


    and then this code

    '***************** Code Start ***************
    Private Sub Form_Timer()
    Me!lblClock.Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss AMPM")
    End Sub

    Private Sub cmdClockStart_Click()
    Me.TimerInterval = 1000
    End Sub

    Private Sub cmdClockEnd_Click()
    Me.TimerInterval = 0
    End Sub
    '***************** Code End ***************

    Problem I have is I can't get it to work right. My form name is DailySheet
    Will Dove
    working hard is better then hardly working ...

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    The name of the form has no influence to the oparation,
    you use Me

    Try
    Private Sub Form_Timer()
    Me!lblClock.Caption = Time()
    End Sub

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Here is an analog o'clock just to learn more
    Attached Files Attached Files

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Mine works great with Time() or Format(...). Could you expand on "can't get it to work right"?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Aug 2002
    Location
    Melbourne, Australia
    Posts
    111
    Have a look at the attachment.
    Attached Files Attached Files
    Regards,



    John A

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Your routine works fine for me! My guess would be that you've you've misspelled the name of one or more of your controls. Like Pootle Flump I'd like to know exactly what you mean by I can't get it to work right. Does the clock not show up at all? Does it not tick off the seconds when you press the cmdClockStart button? Likewise does it not stop when you press the cmdClockEnd button? Inquiring minds want to know!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Missinglinq
    My guess would be that you've you've misspelled the name of one or more of your controls.
    Good point. For this reason I always use

    Me.Mycontrol

    and never

    Me!Mycontrol

    as the former allows you to use intellisense.
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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