Results 1 to 6 of 6
  1. #1
    haylau is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Posts
    5

    Question create new record based on combo box selection

    I thought this would be easy, but apparantly not (for me)

    I have two tables
    Stafftbl
    StaffID
    Name
    Mon Hours


    Tue Hours
    Wed Hours
    etc

    Timecard
    StaffID
    MonHours
    TuesHours
    etc

    The idea being that the staff table contains the standard hours a worker
    works each week, so one record for each staff member.

    The timecard table then is a record of the number of hours worked every week - which varies.

    When I open the timecard form I would like to be able to select a staff
    member from a combo box (lookup from staff table) and then populate the forum with the standard data from the stafftable, then make alterations to store the record. So for example I selct Mr Taylor. The form then pulls out the standard hours worked each day (say 8) I can then modify Monday's hours to 9, and Tuesdays to 7 then store the whole record

    But i am completely baffled as to how to do this. I thought abut a combo box but that only finds the record based on the current table, not a different table

    Any ideas?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This technique should work:

    http://www.baldyweb.com/Autofill.htm

    A combo box can get its selections from a different table than the one the form is based on. It's probably the most common scenario in fact. By the way, personally I would name the fields differently. You will run into situations where you see MonHours and you won't know which it is. I'd name the standard fields MonHoursSched or something like that, to differentiate them.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    haylau is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Posts
    5
    Quote Originally Posted by pbaldy View Post
    This technique should work:

    http://www.baldyweb.com/Autofill.htm

    A combo box can get its selections from a different table than the one the form is based on. It's probably the most common scenario in fact. By the way, personally I would name the fields differently. You will run into situations where you see MonHours and you won't know which it is. I'd name the standard fields MonHoursSched or something like that, to differentiate them.
    Many thanks Paul , exactly what i needed!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help, and welcome to the site!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Dalagrath is offline Only a Man
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Location
    Colorado
    Posts
    45
    Nice stuff there Pbaldy. I love using your website for quick info.

    Also, mark the thread Solved please.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm glad you found it helpful!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 01-24-2011, 07:11 PM
  2. Visibility based on Combo selection
    By jlclark4 in forum Forms
    Replies: 1
    Last Post: 12-22-2010, 11:42 AM
  3. Replies: 1
    Last Post: 11-05-2010, 05:49 PM
  4. Replies: 2
    Last Post: 09-17-2010, 09:53 AM
  5. Replies: 1
    Last Post: 08-26-2009, 10:45 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