Page 1 of 3 123 LastLast
Results 1 to 15 of 31
  1. #1
    donnan33 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    52

    subform controls

    I havea form. it has a main form and 2 sub forms. on data entry i need to be able to enter data on main form then it on enter it goes to first field of first subform which is great. then on last field of first subform it will not go to first field of next subform. it keeps going to back to first fireld of same form not to next sub form. how can i get it to go after tab or entry to first field of next subform?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Try code in the AfterUpdate event of the last control to setfocus to the other subform. Maybe:

    Forms!mainformname.subformcontainername.SetFocus
    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
    donnan33 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    52
    I tried. I can't seem to get anything to work. When data is entered on last field of first subform, tab/enter keeps going to first field of same subform not to the first field of 2nd subform.........Any help?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    It still stays on same form in spite of the suggested code? Do you want to provide project for analysis?
    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.

  5. #5
    donnan33 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    52
    my file is too large to post......I tried

  6. #6
    donnan33 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    52
    I made it smaller so i could send. On last control Notes in subform i am trying to get it to go after update to the vbuild control on the next subform. as you can see it keeps going to first control on same subform. if login box pops up just hit ok. no passsword needed.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    You did not include the attempted code in the posted project. This works:

    Private Sub Notes_LostFocus()
    Me.Parent.[tblUnits Subform].SetFocus
    End Sub
    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.

  8. #8
    donnan33 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    52
    That did the trick thank you. I realized that I was using field name (vbuildcode) and not the cbo box name (cbovbuildid). I have one more question. i have to add a time sheet now for each employee. I have the following fields, start time, timeout1, timein1, timeout2, timein2, finish time. How can I calculate hours worked for each day? I have never worked with the time fields in access and am in the dark......Can you help on this? I really appreciate your time.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    The values are saved as date/time or just time?

    Review this http://allenbrowne.com/casu-13.html
    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.

  10. #10
    donnan33 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    52
    Just time fields. I have one Field for the date entered then all the start, time in, time out, timein, timeout, finish time as time only. I can change this if it makes a difference or which way is best.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    If the times are in a Date/Time type field, try the DateDiff function as explained in the link.

    If a work period crosses midnight, this will not work. Would need the date component in the calculation. I presume all times are within one day since you say you have only one date field.
    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.

  12. #12
    donnan33 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    52
    I used the formula attached. It works for the total hours between starttime and timeout1. I can't get it to do the next 2 time in/out fields to get the total for the day????? I relly appreciate your help. I have never had to use time fields before.....

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Show the expressions you tried.

    Why do you have Start and Finish time fields? Why two timein/timeout 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.

  14. #14
    donnan33 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    52
    I have

    start time
    time in
    time out
    time in
    time out
    finish time

    they sometimes clock out at other times besides lunch. i need to calculate total hours. and most of the time the do not have anything in the second time in/out fields but sometimes they do. I need to get total hours for day of all the above fields. Seems if some are blank it will not calculate?

    i used datediff("n",[starttime], [timeout1]) and this worked fine. when i tried the below i cannot get it tot total all fields
    (datediff("n",[starttime], [timeout1])+(datediff("n",[timein1], [timeout2]) + (datediff("n",[timein2], [finishtime]))

    seems this would give me a total but does not work................this is based on timein1 and timeout2 being blank.

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Right, need to handle null. Calcs with Null return Null. Try the Nz function.

    Nz(datediff("n",[starttime], [timeout1]),0)+Nz((datediff("n",[timein1], [timeout2]),0) + Nz(datediff("n",[timein2], [finishtime]),0)
    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.

Page 1 of 3 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 12-20-2011, 06:48 PM
  2. Replies: 10
    Last Post: 12-31-2010, 12:35 PM
  3. Tab Controls
    By karlhardeman in forum Forms
    Replies: 10
    Last Post: 08-25-2010, 07:01 AM
  4. Replies: 1
    Last Post: 09-28-2009, 05:21 PM
  5. subform controls hidden
    By bkelly in forum Forms
    Replies: 0
    Last Post: 09-26-2009, 10:12 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