Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246

    Unanswered: Clock update on Form

    Hi,
    I have a form that is attached to no table. On it is a Text box that shows the time. As things stands that only shows the time that the form was opened but I want it to update every second.
    So I have set the following
    Form Interval timer = 1000
    Form On Timer event I have attached the following code

    Private Sub Form_Timer()
    Me!Timenow.Caption = Format(Now, "dddddd")
    End Sub

    But I'm getting a Run time error 438 object doe snot support this property or event

    When I run de-bug it highlights the 2nd row of code.

    On the textbox Timenow the On Dirty event has Form_timer

    Anyone can point me as to what I'm doing wrong? To be honest I'm scrambling around in the dark with VB

    Regards
    John

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Clock update on Form

    Originally posted by Sticker
    Hi,
    I have a form that is attached to no table. On it is a Text box that shows the time. As things stands that only shows the time that the form was opened but I want it to update every second.
    So I have set the following
    Form Interval timer = 1000
    Form On Timer event I have attached the following code

    Private Sub Form_Timer()
    Me!Timenow.Caption = Format(Now, "dddddd")
    End Sub

    But I'm getting a Run time error 438 object doe snot support this property or event

    When I run de-bug it highlights the 2nd row of code.

    On the textbox Timenow the On Dirty event has Form_timer

    Anyone can point me as to what I'm doing wrong? To be honest I'm scrambling around in the dark with VB

    Regards
    John
    It helps not to confuse the Caption property of a LABEL with the Value property of a TextBox ...

  3. #3
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Hi Mike,
    Thanks for the reply. That will teach me to not jsut copy code from somewhere and not have a clue what its doing Doh!

    Can you tell me what should be in that line please.

    Regards
    John

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    John,

    Personally I like to use labels for this type of thing ... Like:

    Private Sub Form_Timer()
    MyLabel.Caption=Format(Now,"H:N AMPM")
    DoEvents
    End Sub

  5. #5
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Michael, you are a genius, thanks very much for your invaluable help............is that crawling enough

    Regards
    John

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    You keep saying things like that and I might need to get a raise ...

    The only thing I don't like about VBA timers (and VB timers for that matter) is that they are interruptable ... If you have "intense" operations going on (long queries, complex calculations, etc ...) there will be "gaps" in your time sequence ... It will appear to "skip" time ... There is no way around this because with even using the API timers, they are also subject to the VB/VBA interruptability ...

Posting Permissions

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