Results 1 to 10 of 10
  1. #1
    mrsjtamuno is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    5

    Relationship from the same table. I'm using student database template.

    I am new and self taught with access.



    I work for a school district and we are using the student database template to keep track of students involved in gangs. I need to be able to open one student record and see a list of associates which just link to other student records already in the database. I have no clue where and how to do this. The research I have found said something about a "self join" but I'm not sure if I'm on the right track.

    I have a tab in Student Details for Associates but it's empty. However what I would like is to be able to use that tab to see the list of other student records that they associate with. There is a lot of overlap and I dont want to have to create numerous records of the same student.
    Click image for larger version. 

Name:	Student Details.jpg 
Views:	14 
Size:	197.4 KB 
ID:	31751

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You need a table that has two fields - studentID_1 and studentID_2. This will allow you to display all associates: when you select a student look in both fields for that studentID and display all the students that are related. You can do this in two queries - looking first in studentID_1 and second in studentID_2, joined to the students table to get their names, and then do a UNION query to get the entire list.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    you need a tAssociates table
    [studentID], [AssocID]

    (key both fields so you dont get duplicates)

    make a subform in the main studend form for this table, link them on [studentID] field.
    now you can add associates.
    to see the names of the students , in the subform instead of text box for [AssocID], put a combo box (still linked to [AssocID])
    the combo will show [StudentID], StudentNAME
    set the combo properties:
    columnWidths: 0;2

    this will show the name and the ID will be hidden.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Can a Student be in more than 1 gang?
    Your application/database seems much more extensive than student and associate(s).

  5. #5
    mrsjtamuno is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    5
    They can be in any gang, which is listed separately as just a short text fill in on their record. The associates can be any of the other student records regardless of their gang affiliation.

    Quote Originally Posted by orange View Post
    Can a Student be in more than 1 gang?
    Your application/database seems much more extensive than student and associate(s).

  6. #6
    mrsjtamuno is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    5
    Im sorry but I'm still very confused about where and how to do this. I know how to add fields to the student table but after that im lost.

    Quote Originally Posted by aytee111 View Post
    You need a table that has two fields - studentID_1 and studentID_2. This will allow you to display all associates: when you select a student look in both fields for that studentID and display all the students that are related. You can do this in two queries - looking first in studentID_1 and second in studentID_2, joined to the students table to get their names, and then do a UNION query to get the entire list.

  7. #7
    mrsjtamuno is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    5
    I tried to use this video to help me but it only allows me to add one person as an associate. I need to be able to add multiple students as associates and appear in list form.
    I wish it was as easy as just putting a hyperlink to the associated student records. I'm very lost on how to start to do this.

    Quote Originally Posted by ranman256 View Post
    you need a tAssociates table
    [studentID], [AssocID]

    (key both fields so you dont get duplicates)

    make a subform in the main studend form for this table, link them on [studentID] field.
    now you can add associates.
    to see the names of the students , in the subform instead of text box for [AssocID], put a combo box (still linked to [AssocID])
    the combo will show [StudentID], StudentNAME
    set the combo properties:
    columnWidths: 0;2

    this will show the name and the ID will be hidden.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Here is a link with a lot of info re database planning and design. The tutorials from RogerAccessLibrary will show you a procedure that can be used with any database--but you have to work through the tutorial.
    Spend some time learning concepts and design. Don't be too quick to jump into physical Access database.

    Good luck.

  9. #9
    mrsjtamuno is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    5
    Thank you Thank you Thank you!!!!

    Quote Originally Posted by orange View Post
    Here is a link with a lot of info re database planning and design. The tutorials from RogerAccessLibrary will show you a procedure that can be used with any database--but you have to work through the tutorial.
    Spend some time learning concepts and design. Don't be too quick to jump into physical Access database.

    Good luck.

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    You are welcome.
    Good luck with your project.

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

Similar Threads

  1. Replies: 1
    Last Post: 01-18-2017, 10:29 AM
  2. What kind of relationship should I use for a two table database?
    By receptionist_dude in forum Database Design
    Replies: 5
    Last Post: 06-20-2016, 05:11 PM
  3. Help with Table Planning in Student Database
    By whitelexi in forum Access
    Replies: 5
    Last Post: 03-09-2014, 03:08 PM
  4. Replies: 1
    Last Post: 08-14-2013, 06:29 PM
  5. access student database template
    By austinpeay1999 in forum Access
    Replies: 6
    Last Post: 06-19-2012, 03:43 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