Results 1 to 5 of 5
  1. #1
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243

    Create Relationships

    Clearly, I'm not getting this. I've created the first 2 tables of a total of six I planned for this database. However, after creating the first two I can't get them to "relate" like I had envisioned. I don't want to proceed breaking down the rest of the excel import into more tables until I get the first two tables up and running.

    tblAdvisor is one to many -- one advisor can have many students
    tblStudents is one to one -- one student can only have one advisor

    My goal is to open the tblStudent and have the drop down field below each student display their assigned advisor. Right now the drop down fields are empty, even though I've linked the files.

    Help please. Database attached. Thank you.



    EDIT: I reloaded the database as an mdb file. See 3rd posting with new attachment.
    Attached Files Attached Files

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I have acc2003 so can not open accdb.

    As for your tables as I see it

    You have Advisors and Students,
    then the rules
    -one advisor can have many students
    -one student can only have one advisor

    To show which Advisor "advises" which Students, you need a junction table.

    For example, let's say we have
    Advisors (Id,ProfName) ( could have more fields - this is just for concept)
    01 ProfBob
    02 ProfSammy
    03 ProfAssam

    And
    Students (Id, StudentName)
    01 Jim Smith
    02 Jane Doe
    03 Bunny Rabbit
    04 Easter Bunny
    05 Hans Zoff

    where
    ProfBob advises Jim Smith and Jane Doe and Hans Zoff
    ProfSammy advises Bunny Rabbit
    ProfAssam advises Easter Bunny

    The junction table StudentAdvisors(SA_Id,ProfId (FK to Advisors),StudentId (FK to Students))

    StudentAdvisors
    01,01,01
    02,01,02
    03,01,05 <--iD =3,ADVISORs.ID=1,Students.ID=5 {Interpreting this record ProfBob advises Hans Zoff}
    04,02,03
    05,03,04

    An advisor can advise >1 Student
    A Student has 1 Advisor.

    You would need code to ensure unique Student-Advisor pair (only 1 Advisor for any given Student) and/or
    unique compound index on ( StudentId + ProfId)

  3. #3
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243

    I reloaded the database as an mdb file.

    I reloaded the database as an mdb file to reach a wider audience. Unfortunatly, I can't figure out how to delete the Access 2010 attachment.
    Attached Files Attached Files

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Just looking at your mdb quickly.

    You're bringing in data from Excel, you have a bunch of data basically in a flat file. You don't show any queries about how you extract things from the excel import into your other tables.

    You have 118 records and 104 distinct advisors.

    It does not appear to me that your tables are normalized, but you know your environment and needs better than I do. I see Grants, Contacts, project.... If an advisor can "advise" many students, WHY do you have studentid in the Advisor table?

    I strongly suggest you get a data model of what you are trying to achieve/support. Test that model and make sure it is what you need.
    What other things do you use the data for?

    The sooner you get a model of what you need, the easier it will be to create the extraction, reformat whatever routines. I think you're only showing a piece of what you are trying to accomplish---just my interpretation based on what I'm seeing.

    I think you could benefit from reviewing some online videos related to database design.
    Here are some links to videos and site that should help. These are geared to database design.

    http://www.youtube.com/watch?v=IiVq8M5DBkk Logical data modeling

    http://www.youtube.com/watch?v=BGMwuOtRfqU Candidate key

    http://www.youtube.com/watch?v=ZiB-BKCzS_I Normalization

    http://www.youtube.com/watch?v=pJ47btpjAhA Normalization example

    http://www.youtube.com/watch?v=q3Wg2fZENK0 1st Normal form

    http://www.youtube.com/watch?v=vji0pfliHZI 2nd Normal form

    http://www.youtube.com/watch?v=HH-QR7t-kMo 3rd Normal form

    http://www.youtube.com/watch?v=q1GaaGHHAqM E_R Diagramming

    http://www.youtube.com/watch?v=lXAGQ8vmhCY ERD Part 2

  5. #5
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    Quote Originally Posted by orange View Post
    Just looking at your mdb quickly.

    You're bringing in data from Excel, you have a bunch of data basically in a flat file. You don't show any queries about how you extract things from the excel import into your other tables.

    You have 118 records and 104 distinct advisors.

    It does not appear to me that your tables are normalized, but you know your environment and needs better than I do. I see Grants, Contacts, project.... If an advisor can "advise" many students, WHY do you have studentid in the Advisor table?

    I strongly suggest you get a data model of what you are trying to achieve/support. Test that model and make sure it is what you need.
    What other things do you use the data for?

    The sooner you get a model of what you need, the easier it will be to create the extraction, reformat whatever routines. I think you're only showing a piece of what you are trying to accomplish---just my interpretation based on what I'm seeing.

    I think you could benefit from reviewing some online videos related to database design.
    Here are some links to videos and site that should help. These are geared to database design.

    http://www.youtube.com/watch?v=IiVq8M5DBkk Logical data modeling

    http://www.youtube.com/watch?v=BGMwuOtRfqU Candidate key

    http://www.youtube.com/watch?v=ZiB-BKCzS_I Normalization

    http://www.youtube.com/watch?v=pJ47btpjAhA Normalization example

    http://www.youtube.com/watch?v=q3Wg2fZENK0 1st Normal form

    http://www.youtube.com/watch?v=vji0pfliHZI 2nd Normal form

    http://www.youtube.com/watch?v=HH-QR7t-kMo 3rd Normal form

    http://www.youtube.com/watch?v=q1GaaGHHAqM E_R Diagramming

    http://www.youtube.com/watch?v=lXAGQ8vmhCY ERD Part 2
    This was my original data model.

    Click image for larger version. 

Name:	DataModel.jpg 
Views:	4 
Size:	165.1 KB 
ID:	6809

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

Similar Threads

  1. Replies: 15
    Last Post: 01-04-2012, 05:03 PM
  2. Replies: 5
    Last Post: 09-17-2011, 12:44 PM
  3. Relationships
    By IT_GIRL in forum Access
    Replies: 3
    Last Post: 06-27-2011, 02:27 PM
  4. Replies: 3
    Last Post: 06-07-2011, 05:05 PM
  5. One to One Relationships
    By ketbdnetbp in forum Database Design
    Replies: 1
    Last Post: 04-27-2011, 11:22 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