Results 1 to 5 of 5
  1. #1
    Alphix is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    61

    Successive field does not populate and last field does not get result (Elapsed Time)

    Hi, I have tried and tried and tried and still have not figured out how to apply code to my elapsed time form.



    The code suppose to allow the user to do the following:

    (1) press the start button (capture time stamp)
    (2) press stop button (capture time stamp)
    (3) press start button (capture time stamp)

    (4) Now calculate down time put result in available field

    (5) After several start and stop times - at the very end give me the total start time and total down time.


    Please see attachment.


    Thank you in advance.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    The form is not bound to table. Set the form RecordSource property. The textboxes on the form are not bound to fields. They have the textbox name in the ControlSource, not the field names. After binding the form, set the ControlSource property of each textbox to appropriate field.

    Then expression in ControlSource property of each third textbox would be like:

    =DateDiff("h",[Time1],[Time2])

    Now VBA behind the buttons could be like:

    Private Sub Command12_Click()
    Me.Text0 = Now
    End Sub

    Suggest you give the controls more meaningful names, such as btnEvent1Start and tbxEvent1Start.

    This table structure allows only 3 pairs of start/stop times. This is not a normalized data structure. What if you need a fourth or more pairs?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Alphix is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    61
    Yes I see, this was a sample database. My intention was to make several more buttons to reflect different event types a few more time capture fields.

    I was trying to get total down time and up time per shift per employee and make this query capable.

  4. #4
    Alphix is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    61
    As each click of the button how does the form know to place the next time in the next succeeding blank field?

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    A button for each field/textbox. Change the code as appropriate to reference the correct field/textbox.

    Move to new record when you want to start entry for next employee.

    BTW, need field in table for employee ID. And combobox on form to select employee. But first need a table of employees.

    Why do you care about 'down' time?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-27-2013, 05:24 PM
  2. Populate Field when result is Null
    By BarneyH4 in forum Queries
    Replies: 3
    Last Post: 06-25-2013, 11:03 AM
  3. Replies: 2
    Last Post: 01-08-2013, 08:49 AM
  4. Storing Elapsed Time in a Field
    By andybuck86 in forum Access
    Replies: 1
    Last Post: 10-08-2011, 05:07 AM
  5. Replies: 3
    Last Post: 10-03-2011, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums