Results 1 to 7 of 7
  1. #1
    1234kay is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    3

    Relationship to determine Substitute Availablity

    Hi there, I have an access database where I input all staff (Table_AllStaff). In this staff list I indicate if someone is a sub teacher with a yes/no checkbox, they also have to be a current staff member which is also indicated by a yes/no checkbox.

    I have created another table (Table_Programs) that lists our programs, days the program run, and the hours of the programs.

    I want to create a third table that joins my main table with the program table to create a substitute availability calendar/report. I have tried to build relationships between the tables, but have been unsuccessful as I keep getting a "No Unique Index found for the reference" and I don't know why that's happening.



    What I want to do is have all of the sub names populate on the third table where I can select the programs they are available/qualified to sub for so that I can generate a sub list which clearly shows the name, contact info, and the specific availability for each of our subs.

    If anyone is able to offer any assistance it would be greatly appreciated. Please let me know if you need more information.
    Thanks in advance!!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Are you using autonumber primary key in each of the first 2 tables? The first 2 tables should each relate to 3rd table.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    1234kay is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    3
    I do have the primary keys set as an auto-number for each of the tables.
    I have attached the database I am using but have removed all data.
    Please let me know if you have any questions.

    Thanks!
    Kristen
    Attached Files Attached Files

  4. #4
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    Have a look at this. It properly sets up your tables in a many-to-many arrangement. Included a form to show how to assign subs that update the junction table.
    I removed many redundant (duplicated) fields in the tables. Added a field to the junction table to show date assigned to sub.
    Staff and Sub Lists-davegri-v01.zip

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Do not save staff info into Availability. Just save ID primary key into a number field. Same for Programs.

    Reason for relational database is to not repeat info in multiple tables. Related info is retrieved in queries by joining tables. That's why it's called relational database. Have you studied an introductory tutorial book? A solid week with one might be beneficial.

    Might give these ID fields more distinctive names so they aren't identical.
    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.

  6. #6
    1234kay is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    3
    Thanks @davegri. This looks amazing. Now i will do some more research on how it all works Can you suggest any keys things that I can look up, such as junction table, etc.
    @June7 - Am I correct in thinking that I don't need to input the same fields into each table because all main info is listed in the main database but I do need to have one field the same in those tables if I want to set up a relationship between them?
    Thanks again for your help. I'm excited to try it out!

  7. #7
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    Can you suggest any keys things that I can look up, such as junction table, etc.
    The primary concept is the notion of Many-to-Many relationships. You have many subs and many programs, with the need to relate them. MTM is how it is done.

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

Similar Threads

  1. substitute VLOOKUP that’s done in Excel
    By funzone in forum Access
    Replies: 6
    Last Post: 01-04-2017, 07:51 AM
  2. Substitute new table with same name
    By louise in forum Import/Export Data
    Replies: 3
    Last Post: 01-03-2016, 09:44 PM
  3. Substitute for overly-long IIf statement?
    By Captain Database ...!! in forum Queries
    Replies: 14
    Last Post: 07-14-2011, 12:00 PM
  4. Substitute a subform
    By nbdwt73 in forum Access
    Replies: 2
    Last Post: 11-13-2009, 02:37 PM
  5. Substitute Teacher in need of answer key!
    By misssunshine1973 in forum Access
    Replies: 4
    Last Post: 05-14-2009, 02:25 AM

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