Results 1 to 4 of 4
  1. #1
    bhartley123 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    2

    How to do I populate a junction table as records are added/updated in a form?

    I am pretty new to Access. I have a table that is Staff, with a primary key of StaffID, and I have a table with Services, with a primary key of ServiceID. I know I can create a junction table that links a StaffID to a Service ID, for a many to many relationship, but I want to be able to populate that junction table within a form. Staff can be linked to multiple services and services can be linked to multiple staff.



    How can I have a form for a service, which has fields for Primary Staff Contact and Secondary Staff Contact, where the field has a drop-down of staff names to select? And once the staff name is selected, the junction table record linking the staff and services ideas is created? And if the Primary Staff Contact field is changed, with a new name selected, the junction table field is changed as well.

    I just can't seem to understand how to do this without entering all the junction table records by hand. I know there has to be an easier way. I am not yet very familiar with SQL, so I only use Access.

    The staff table and Service table are already populated. I just want to pull up a form where I can create and update those linked names easily. Any help is appreciated, including a link to videos. Most of the videos I find tell me how to create the junction table for a many-to-many relationship, but they always seem to assume I am going to create those links in the table ahead of time.

    Thanks!!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you need a tStaffSvc table.
    staffID
    ServiceID

    key both fields.
    make 2 forms, 1 for master table tStaff, and a form for the tStaffSvc sub-form.
    put the subform in the master form and link on StaffID.
    then enter services for each staff.

  3. #3
    bhartley123 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    2
    The problem I have is that both the Staff and Service tables are master tables that are linked to other tables. One is not a parent and the other a child. Will that matter? Also, I am really linking staff to services rather than services to staff. And I will need to be able to unlink them and link someone else as changes are made. Will it work for that? I don't want the old relationship to still be in the table.

    I also want to be able to select the staff member for the serive from a drop-down. I guess I am not picturing from what you have listed. (Beginner!)

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Most of the videos I find tell me how to create the junction table for a many-to-many relationship, but they always seem to assume I am going to create those links in the table ahead of time.
    That is true. The data model -- a structure made up of tables, attributes and relationships -- is based on your business rules. The Business Rules are identified through analysis of your Business. The data model, which can be pencil and paper/ cardboard cutouts on a wall joined with colored lines, represents a blue print of your database. The data model can be tested with sample data. The data model is complete when the data model and all the test scenarios are validated. Whenever there is an issue during testing, it must be resolved --was it bad data, a missing entity, incorrect relationship...?? More analysis until resolved.

    Now you build the database according to the blueprint.

    Getting your tables and relationships designed (and validated) to meet your requirements is the most critical part of database. Failure to do so will result in workarounds and frustration.

    Good luck with your project.

    A good tutorial on database design is this one from RogersAccess Library.

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

Similar Threads

  1. Replies: 1
    Last Post: 06-24-2014, 01:31 PM
  2. Replies: 3
    Last Post: 03-10-2014, 08:51 AM
  3. Populate Junction Table related to 3 Tables
    By Daoud1987 in forum Access
    Replies: 5
    Last Post: 12-11-2013, 12:13 PM
  4. Replies: 1
    Last Post: 02-16-2013, 11:36 AM
  5. How to use Junction Table to populate DB
    By Sorbz62 in forum Forms
    Replies: 1
    Last Post: 10-02-2011, 05:45 PM

Tags for this Thread

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