Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2005
    Posts
    5

    Unanswered: Updating Time in a Form

    I have a text box with a control of =time() so that the current system time is shown.

    However it only shows the time of when the form was opened. I want it to constantly update, so it changes in real time.

    I tried a macro that closed and opened the form every second but it made the form unusable and had bad lag. Help appreciated

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    there are a couple of possibilities
    the closes to your design requiremnt is to use a timer control. You will need to decide what interval you require to update the time, and place some code in the timer event function to refresh you control containg the time.

    another possibility is to place some code in the forms on current event (occurs every time the user navigates between records)

    Out of curiousity is there good clear design requirement to display the time?

  3. #3
    Join Date
    Jul 2004
    Location
    Southampton, UK
    Posts
    368
    Following on from what Healdem said, take a look here.

    Otherwise do a search for a custom built control.

  4. #4
    Join Date
    Nov 2005
    Posts
    5
    can u update just one individual control? I only thought you could refresh whole forms?


    The client wants a clock apparently so they can syncronise their daily record maintenace. So i presume so they can look at the time, see that its 4pm and check any orders than have been completed through the day that can be sent to archival

  5. #5
    Join Date
    Nov 2005
    Posts
    5
    That example wreb page is perfect nice one

  6. #6
    Join Date
    Aug 2002
    Location
    Northampton, England
    Posts
    266
    You could call this function in the On Current event of the form.

    Function ChangeCaption()

    Dim i As Integer

    For i = 0 To Forms.Count - 1

    Forms(i).Caption = Format(Now, "dddd,mmm d yyyy,hh:mm:ss AMPM")
    Next i

    End Function

    Or this line of code in the timer event of the form.

    Me!lblClock.Caption = Format(Now, "dddd,mmm d yyyy,hh:mm:ss AMPM")

Posting Permissions

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