Linking primary key

  • Thread starter Thread starter k11ngy
  • Start date Start date
K

k11ngy

I have 2 forms, 1 called student and one called courses

I have created one main form and trying to get it to work so that when
student ID is typed in then their details automaticly come up but having no
success?

Thanks

Steve
 
Create another table called StudentCouses which will contain the primary
key's for both StudentID and CourseID. Create a subform on the table
StudentCourses that contains a combo box with the CourseID and CourseName,
and is linked on a (can be hidden) textbox for StudentID.
 
Steve-
I assume your main form shows the student's info...if so, I usually just put
a combo box in the header area and follow the Wizard selecting the option to
"find a record
on my form based on the value selected in the combo box." Fields would be
primary key, student number, name if you want...
Jill
 
Steve,

Generally, when you are trying to identify courses that students are
assigned to, you will need a few more tables:

1. tbl_Students - this should just contain info that is specific to the
student. Fields include StudentID, DOB, First_Name, Last_Name, ...
2. tbl_Courses - this should contain CourseID, course number, titles, ...
3. tbl_Course_Offerings - this would indicate details about specific course
offerings. Fields should include Course_Offering_ID, Course number, academic
year, semester, building, room, teacher, ...
4. tbl_Student_Courses - this table would probably contain StudentID,
CourseOfferingID, Grade

Once you have that type of structure, you can create a form
(frm_Student_Courses) that is based off of a query that joins tbl_Students to
tbl_Student_Courses, tbl_Student_Courses to tbl_Course_Offerings, and
tbl_Course_Offerings to tbl_Courses. This query would probably contain
fields like StudentID, CourseOfferingID, AcademicYear, Semester, CourseName,
and maybe Grade.

Once you have that form working, you can add it as a subform to your
frm_Students, and link the two on StudentID. Then, as you move from one
student to another, you will see the courses that that student has taken in
the subform.
 
Back
Top