Results 1 to 8 of 8

Thread: Running Clock

  1. #1

    Running Clock

    I would like to put a running timer on my switchboard page in the header to the right of the start page name. I want this clock to mimick the computer clock with a running second count if Possible. Sorry new to Access
    Scooter172

  2. #2
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    Create a label on your form, I would call it lblClock or lblTime... something you fancy,

    Then on the form properties, Set timer interval to 1, then On Timer event add the following code.

    [VBA]
    Private Sub Form_Timer()
    Me!lblClock.Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss AMPM")
    End Sub
    [/VBA]
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

  3. #3

    Hmmm

    I get an error, stating that it is not proper use of Me! statement
    Scooter172

  4. #4
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    Then try Me.lblClock.Caption, see if that works for you.

    The one thing I don't like about that is the refreshing seems to be very sporadic... meaning it ticks fine, but occassionaly your screen jumps all over the place.

    Perhaps someone else has a better idea, but I haven't quite figured out how to fix both issues at the same time.
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

  5. #5

    Not working

    Attachment 4374

    Here is a screen shot of how that ended up
    Scooter172

  6. #6
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    [vba]Private Sub Form_Timer()
    Me.lblClock.Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss AMPM")
    End Sub [/vba]
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

  7. #7

    Stumped

    I have still not had luck making this work.. I have reset timer to 1 and then entered the code in the cell On Timer and I get nothing...Zip Zero Notta!!
    Scooter172

  8. #8
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    I'm not sure what is going wrong.

    Are your lables the same as what is being called in the Sub? Are you calling the On_Timer event from the Main form? Or are you trying to call it somewhere else? You mentioned you put the code in the cell... It shouldn't be in a cell. It should be bound to the form's timer. See if this file works any different.
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

Posting Permissions

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