Using MS Access 2007, I am creating a student management database. I have tables for:
使用MS Access 2007,我正在创建一个学生管理数据库。我有桌子:
- Students
- Courses
- CourseSection
What I needed is a way to assign students to a course section. So I created a table that links students and sessions:
我需要的是一种将学生分配到课程部分的方法。所以我创建了一个链接学生和会话的表格:
- StudentsInSection (contains foreign key to students and foreign key to course section)
StudentsInSection(包含学生的外键和课程的外键部分)
I would like to create a form that allows me to edit a section and add students from the list of students. I've done lots of relational database work, just never with access. It seems like such a simple thing. Anybody know a good way to do this?
我想创建一个表单,允许我编辑一个部分并添加学生列表中的学生。我做了很多关系数据库工作,从来没有访问过。这似乎是一件简单的事情。有人知道这样做的好方法吗?
2 个解决方案
#1
2
Create a form bound to the StudentsInSection table. If you want to be able to edit the students in the section, the easiest thing to do is to use a combo box with a row source based on the Students table with the bound column of the combo box tied to the student ID in the recordset underlying the StudentsInSection form. This form will be your subform. Set the Default View property of the form to "Datasheet" or "Continuous Forms". Save and close the form.
创建绑定到StudentsInSection表的表单。如果您希望能够在该部分中编辑学生,最简单的方法是使用基于Students表的行源组合框,其中组合框的绑定列与记录集中的学生ID绑定作为StudentsInSection表格的基础。此表单将成为您的子表单。将窗体的默认视图属性设置为“数据表”或“连续窗体”。保存并关闭表单。
Create a form bound to the CourseSection table. From the Forms list, click and drag the first form based on the StudentsInSection table onto the design area of the CourseSection form.
创建一个绑定到CourseSection表的表单。从“表单”列表中,单击并将基于StudentsInSection表的第一个表单拖到CourseSection表单的设计区域。
In the property sheet of the new subform control, set the Link Master Fields property to the Section ID of your CourseSection table. In the Link Child Fields property, set the value to the Section ID of your StudentsInSection table. Setting these properties will filter the subform data to match the current value in the parent form as records are navigated.
在新子窗体控件的属性表中,将“链接主字段”属性设置为CourseSection表的“节ID”。在“链接子字段”属性中,将值设置为StudentsInSection表的“节ID”。设置这些属性将过滤子表单数据,以便在导航记录时匹配父表单中的当前值。
#2
1
The easiest thing you can do is create a sub-form off a main form. Base the main form off of Students and base the sub-form off of StudentsSection. On the sub form, add a pull down for selecting the course.
您可以做的最简单的事情是从主窗体创建一个子窗体。将主要表格基于学生,并将子表格基于StudentsSection。在子表单上,添加下拉菜单以选择课程。
That way the StudentSection will get populated with the StudentID (I assume that's your key) from the parent form, and you can set the CourseID when you set the pull down.
这样,StudentSection将从父表单填充StudentID(我认为这是您的密钥),并且您可以在设置下拉时设置CourseID。
#1
2
Create a form bound to the StudentsInSection table. If you want to be able to edit the students in the section, the easiest thing to do is to use a combo box with a row source based on the Students table with the bound column of the combo box tied to the student ID in the recordset underlying the StudentsInSection form. This form will be your subform. Set the Default View property of the form to "Datasheet" or "Continuous Forms". Save and close the form.
创建绑定到StudentsInSection表的表单。如果您希望能够在该部分中编辑学生,最简单的方法是使用基于Students表的行源组合框,其中组合框的绑定列与记录集中的学生ID绑定作为StudentsInSection表格的基础。此表单将成为您的子表单。将窗体的默认视图属性设置为“数据表”或“连续窗体”。保存并关闭表单。
Create a form bound to the CourseSection table. From the Forms list, click and drag the first form based on the StudentsInSection table onto the design area of the CourseSection form.
创建一个绑定到CourseSection表的表单。从“表单”列表中,单击并将基于StudentsInSection表的第一个表单拖到CourseSection表单的设计区域。
In the property sheet of the new subform control, set the Link Master Fields property to the Section ID of your CourseSection table. In the Link Child Fields property, set the value to the Section ID of your StudentsInSection table. Setting these properties will filter the subform data to match the current value in the parent form as records are navigated.
在新子窗体控件的属性表中,将“链接主字段”属性设置为CourseSection表的“节ID”。在“链接子字段”属性中,将值设置为StudentsInSection表的“节ID”。设置这些属性将过滤子表单数据,以便在导航记录时匹配父表单中的当前值。
#2
1
The easiest thing you can do is create a sub-form off a main form. Base the main form off of Students and base the sub-form off of StudentsSection. On the sub form, add a pull down for selecting the course.
您可以做的最简单的事情是从主窗体创建一个子窗体。将主要表格基于学生,并将子表格基于StudentsSection。在子表单上,添加下拉菜单以选择课程。
That way the StudentSection will get populated with the StudentID (I assume that's your key) from the parent form, and you can set the CourseID when you set the pull down.
这样,StudentSection将从父表单填充StudentID(我认为这是您的密钥),并且您可以在设置下拉时设置CourseID。