Results 1 to 3 of 3
  1. #1
    Ruthers456 is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    1

    Hours and OT Hours

    I am creating a form and wanted to know if there was a way to automatically correct the field Hours and fill in the field OT. For example if I were to input 10 in the Hours field and enter or tab to the OT field, it would change the Hours field to 8 and input 2 in the OT field. Thanks so much for your help.

  2. #2
    Yesideez is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Location
    Devon, UK
    Posts
    17
    Off the top of my head (and having just accidentally come across the code builder) I'd look at creating a function attached to the "On Lost Focus" event to do a check with modular division and update the relevant field(s) if needed.

  3. #3
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Lets assume the data would be in 2 textboxes, txtRegHours, and txtOTHours. I didn't confirm my syntax but basically what the following does is check to see if the number entered is over 8. If so, it asks the user whether the remainder should be applied to OT. If the user clicks yes, it does so. If the user clicks no, then it clears and resets. This can be entered on any event you wish.


    if (Me.txtRegHours > 8) Then
    if(MsgBox "You have entered in over 8 hours for Regular Time. Would you like to add the remaining to Overtime?", vbYesNo) = vbYes Then
    Me.txtOTHours = Me.txtRegHours - 8
    Me.txtRegHours = 8
    Else
    Me.txtRegHours = vbNullString
    Me.txtOTHours = vbNullString
    EndIf
    Else
    EndIf
    ExitSub

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

Similar Threads

  1. Sum hours worked, grouped by dep't
    By goodfood in forum Queries
    Replies: 3
    Last Post: 05-05-2011, 06:11 AM
  2. calculated hours per week in a query Help???
    By manos39 in forum Queries
    Replies: 0
    Last Post: 02-16-2011, 04:17 AM
  3. workinkg hours by percent
    By Mosely in forum Queries
    Replies: 1
    Last Post: 11-01-2010, 09:32 AM
  4. Grouping hours query
    By DMP84 in forum Queries
    Replies: 0
    Last Post: 08-26-2010, 07:15 AM
  5. hours + condition
    By Miriam in forum Queries
    Replies: 0
    Last Post: 08-09-2009, 06:46 AM

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