当我重新打开程序时,访问表单中的自动填充字段不起作用 [英] auto populate field in access form doesn't work when I reopen my program
问题描述
我的数据库中有两个表。一个是课程(CourseID,课程名称),另一个是学生(StudentID,学生姓名,CourseID,课程名称)。
所以我想为这个学生表创建一个表单,每当我输入courseID值时,课程名称应该自动显示在coursename字段中。为此,我在这两个表之间创建了一个关系,并创建了一个名为
" After update"的触发器。学生表格的courseID属性。这样做,它根据我从课程表输入的courseID填写表单中的属性值。这在我创建一个新程序时工作正常,但问题来自
我重新打开我的访问程序。它根本不起作用。有没有人知道为什么会这样?
推荐答案
1。您不需要Student表中的CourseName字段,因为它可以从CourseID派生。您可以在表单和报表上使用组合框来显示与CourseID对应的CourseName。
1. You don't need a CourseName field in the Student table, since it can be derived from the CourseID. You can use a combo box on forms and reports to display the CourseName corresponding to the CourseID.
2。我假设一个学生可以参加多个课程,多个学生可以参加同一个课程。这是一种所谓的多对多关系。要实现它,您需要三个表:
2. I assume that one student can attend multiple courses, and multiple students can attend the same course. This is a so-called many-to-many relationship. To implement it, you need three tables:
- 学生 - 包含StudentID,StudentName和其他与学生相关的信息。
- 课程 - 使用CourseID,CourseName和其他与课程相关的信息。
- 出勤 - 哪个学生参加哪个课程,包括StudentID,CourseID以及与此学生课程组合相关的信息。
您可以使用包含子表单的表单进行数据输入。请参阅
https://www.dropbox.com/s/aohysaxp646ws6y/Many2Many.mdb ?dl = 1 是一个非常简单的例子。
You can use a form with subform for data entry purposes. See https://www.dropbox.com/s/aohysaxp646ws6y/Many2Many.mdb?dl=1 for a very simple example.
这篇关于当我重新打开程序时,访问表单中的自动填充字段不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!