Search code examples
ms-accessmany-to-manysubform

Editing junction table as subform via Form


I have following tables:

Course table:
CourseID(primary key) + (first field in combo box)
CourseName(second field in combo box)
CourseDescription

Students table(source for Main form):
StudentID (primary key)
StudentName
StudentPhone
StudentEmail


Enrollments table(junction table and source for subForm)
CourseID (foreign key referencing the Courses table) + made into combo box that stores selected value into CourseID
StudentID (foreign key referencing the Students table)

Both fields in Enrollments table are primary keys

General idea

I hope that the fact everything is in polish will not bother you. I would like to assign Student selected in Main form to X amount of courses via SubForm but it won't let me edit IdKlient(IdCourses). Error states: can't edit this control, it's related with auto increment field "IdKlient"(IdCourses)


Solution

  • After playing around I found that unchecking "cascade delete Related Records" in relationships between Courses and Students to Enrollments table fixed the issue and gave me disired effect.