Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2012
    Posts
    4

    Unanswered: Need to create a form to log the start, end and pause time for a task?

    Hi,

    I am creating a productivity database in Access 2003 and need the user to log via a form when they start and end a task. I have got the basic form up and running, but now I need to incorporate a pause button, along with logging the reason for pausing the task.

    My table is set up with the following fields:

    "Date Logged" "Time Started" "Time Ended" "Duration Paused" "Reason Paused"

    I am new to Access so have been working my way through a skill port course, the help file and google this is how I have done it so far on the form:

    I have a button labelled "Start Task" with the following code set to the onclick event:

    Private Sub Command11_Click()
    [Time Started] = Now()
    Me.Command11.Caption = "Timer Running"
    End Sub

    When they have finished a task they click another button lablled "End Task and Submit" with the following code set again on the onclick event:

    Private Sub Command12_Click()

    [Time Finished] = Now()

    msg = "Are you sure you want to end this task and submit?"
    Style = vbYesNo + vbCritical + vbDefaultButton2
    Title = "End Task and Submit"
    Response = MsgBox(msg, Style, Title)
    If Response = vbYes Then
    Me.Command11.Caption = "Start Task"
    DoCmd.GoToRecord , , acNext
    End If

    Exit_Command12_Click:
    Exit Sub

    Err_Command12_Click:
    MsgBox Err.Description
    Resume Exit_Command12_Click
    End Sub

    When they press this it resets the caption on the first button and moves to the next blank record.

    I need to somehow incorporate a pause function into this, and record the total time paused separately along with a reason for the pause. The reason would be selected from a drop down box.

    The pause functionality is causing me the head ache, I don't think my initial solution is the best, and my knowledge is still quite limited so there is probably a much more simple solution out there.

    Any help on the code I would need to be able to integrate the pause functionality would be greatly appreciated or if Access has built in functions that I could use?

    Regards,

    Mark

  2. #2
    Join Date
    Feb 2012
    Posts
    14
    Do you REALLY need pause in the long run? In other words, how is:
    Start->beginpause->endpause->finish
    superior to:
    Start->finish->startagain->finishagain
    ?

  3. #3
    Join Date
    Mar 2012
    Posts
    4
    The managers want it so that the task they are supposed to be doing is only logged once within the database, and if someone has to stop the task for any reason i.e a colleague asking for help they can pause it select the reason and then continue when they have finished.

    They ultimately want to be able to query the database to see which employees are asking for help from others, so that they can provide coaching or additional training. They also want to see how many hours of productivity people are loosing as a result of this.

    Hope that clarifies it for you.

    Regards,

    Mark

  4. #4
    Join Date
    Feb 2012
    Posts
    14
    If you will have multiple pauses, like:
    start->pause->resume->pauseagain->resumeagain->finish
    then I'd do a separate table for the pauses.

    Main table:
    1, mop floor, 300 minutes

    pause table:
    1, 1, restroom, 5 minutes
    1, 2, fetch supplies, 20 minutes
    1, 3, lost keys, 15 minutes

    (Assuming you haven't already done this)

  5. #5
    Join Date
    Mar 2012
    Posts
    4
    I haven't set that table up but it seems a good idea, I could then build queries and reports specifically for the pause time.

    On the pause table would I need to set up a foreign key linking to the primary key on the table where the work times are logged? Or would just creating a one to many relationship between the tables be enough?

    My form is linked to the main table, so to create the pause buttons I'm thinking I need to create a subform and link that to the pause table, does that sound right?

    Thank you for continued assistance with this.

    Regards,

    Mark

  6. #6
    Join Date
    Feb 2012
    Posts
    14
    Quote Originally Posted by hax View Post
    On the pause table would I need to set up a foreign key linking to the primary key on the table where the work times are logged?
    Yeah. That's illustrated in the first column of my sample data.

    Quote Originally Posted by hax View Post
    My form is linked to the main table, so to create the pause buttons I'm thinking I need to create a subform and link that to the pause table, does that sound right?
    Yeah. A subform or a modal dialog form (my personal preference - the user is locked in there until they're done pausing) would both work.

  7. #7
    Join Date
    Mar 2012
    Posts
    4
    All working now, thank you so much for all your help.

Posting Permissions

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