Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Displaying a stop watch that is binded to a text box.

Discussion in 'Information Technology' started by AccessDabbler, Jul 28, 2006.

  1. AccessDabbler

    AccessDabbler
    Expand Collapse
    Guest

    I was wondering if there could be a stop watch displayed that would start
    once the cursor is inside this one text box in a form and stops once another
    button is pressed. It is basically a text box used for write ups, where i am
    trying to track the time a person takes to write a report up. If anyone could
    help, that be great!
     
  2. Loading...


  3. Ron2006

    Ron2006
    Expand Collapse
    Guest

    Here is some code relative to displaying a clock/time (digital) on the
    form.

    If you have a hidden txtbox with the start time then you could change
    the visible time by subtracting the hidden one from the visible one on
    the update. When you stopped the time, the visible one would then have
    the time involved.

    You may want to consider simply converting the display instead to just
    be a number that you increment on the timerevent. Change the interval
    to be the number that represents 30 seconds and then have the display
    "time" just be a decimal number that you add .5 to at the timer
    interval. When you start set the display to 0 and the timer interval
    to 30 seconds. At the interval add .5 and then when you stop move 0 to
    the timer interval and save the accumulated number to whereever you
    want.

    Things to think about.
    Can they restart the counter/timer by moving off the record? or hitting
    start again (enter the first field again)? What if they accidentally
    tab into the start? If you use the table field to hold the data, what
    if their computer crashes or the network connection goes south, can
    they restart. If they do restart, is it accumulative or replacing.

    The juggling act is how to allow for crashes but cut back on mis-use -
    particularly if they are being judged on it.

    Create a clock on a form
    Author(s)
    Dev Ashish


    To 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.

    You can also create two command buttons called cmdClockStart and
    cmdClockEnd and attach respective code to each to have the clock run on
    demand.

    '***************** 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 ***************
     
  4. ACcesstini

    ACcesstini
    Expand Collapse
    Guest

    Hey Ron,
    Thanks for the instant reply. I had already set a clock by the box,
    hence thanks for the code anyway. The employees are going to be judged on the
    amount of time they take to write in this particular text box, since it is
    going to be a part of the incentive program that is going on. I am just
    trying to see if i can somehow create this stop watch which would record the
    time it is taking for them to write up. You did bring up some good points

    - If they do hit the tab button by mistake then they would have to come back
    to the text box and start from where they left...
    - If they do loose network connection then they would have to start over
    again.

    The problem i am facing trying to make this work is a couple of things which
    i want to clarify and see what others have to say...

    This a OrderActivity Form. Which means all the activities related with this
    order are going to be put in here. It has check boxes, drop downs and one
    main text box where the final report is written up.
    If you break the process down in steps---
    They go into the form on clicking on a button of another form( Main order
    form). The OrderActivity Form opens up and they check boxes, select things
    from drop downs and then start their write ups in the text box.
    They then press another button for our agent performance grading page, they
    check the appropriate boxes and close the window.
    They then generate a report which has info from this form and the write up.
    Then they close the form.


    I want to get the timer working with this form but there are other things to
    look at.
    There are times when this form could be visited by other employees incase
    clients need a quick verbal on the order and where things stand as of that
    minute. Hence i can't get the timer on just the form cuz it might reset.
    I don't want it to reset, nor do i want start, stop and reset buttons. They
    should have no control over the timer. To reduce the time spent by employees
    in writing up, i am helping in skiptrace efforts where ready made info on the
    web will be feeded into this text box so that they don't have to go looking
    for extra info. Now adding this might start the timer because it is being
    inputted into that text box. The problem is there are alot of dependencies on
    getting this timer working. I need an easier way to tackle this problem
    without giving them any control over resetting it.

    "Ron2006" wrote:

    > Here is some code relative to displaying a clock/time (digital) on the
    > form.
    >
    > If you have a hidden txtbox with the start time then you could change
    > the visible time by subtracting the hidden one from the visible one on
    > the update. When you stopped the time, the visible one would then have
    > the time involved.
    >
    > You may want to consider simply converting the display instead to just
    > be a number that you increment on the timerevent. Change the interval
    > to be the number that represents 30 seconds and then have the display
    > "time" just be a decimal number that you add .5 to at the timer
    > interval. When you start set the display to 0 and the timer interval
    > to 30 seconds. At the interval add .5 and then when you stop move 0 to
    > the timer interval and save the accumulated number to whereever you
    > want.
    >
    > Things to think about.
    > Can they restart the counter/timer by moving off the record? or hitting
    > start again (enter the first field again)? What if they accidentally
    > tab into the start? If you use the table field to hold the data, what
    > if their computer crashes or the network connection goes south, can
    > they restart. If they do restart, is it accumulative or replacing.
    >
    > The juggling act is how to allow for crashes but cut back on mis-use -
    > particularly if they are being judged on it.
    >
    > Create a clock on a form
    > Author(s)
    > Dev Ashish
    >
    >
    > To 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.
    >
    > You can also create two command buttons called cmdClockStart and
    > cmdClockEnd and attach respective code to each to have the clock run on
    > demand.
    >
    > '***************** 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 ***************
    >
    >
     
  5. Ron2006

    Ron2006
    Expand Collapse
    Guest

    You have your work cut out for you...........

    Defining what to time and then when to time it.

    If you have a logon ID and a creator ID then that could stop you from
    timing it when someone else is looking at it for a quote-whatever. But
    if the same person if only looking now instead of entering, you would
    still have the problem.

    Are you wanting to only time it when it is a new record, maybe?

    Can they make changes once the order is setup and do you want to time
    that?

    A new order button to only then allow changes (start timer then). New
    order as opposed to new record. Corrections/changes?

    Decisions, Decisions.

    Good Luck
     

Share This Page