如何创建将数据放入两个表中的数据输入表单

发布于 2024-12-19 06:17:18 字数 510 浏览 4 评论 0原文

我有学生课程表,

Student
--------
ID - Primary Key - AutoNumber
Name - Text
Age - Number

Courses
-------
CID - Foreign Key
CourseTitle - Text

学生表中的ID链接到课程

问题CID strong>

我想创建一个简单的数据输入表单,用于收集学生姓名年龄课程标题。姓名和年龄应位于 Student 表中,但是课程标题​​应位于 Course 表中。

我该怎么做?我知道如何创建一个将数据放入一个表中的数据输入表单,但不知道如何在维护关系的同时将其放入两个表中。我真的很感激屏幕截图。

I have Student and Course Tables

Student
--------
ID - Primary Key - AutoNumber
Name - Text
Age - Number

Courses
-------
CID - Foreign Key
CourseTitle - Text

ID in Student table is linked to CID in Courses

Question

I want to create a simple Data Entry form that collects a Students Name, Age and Course Title. The Name and Age should go in Student table however, the Course Title should go in Course table.

How do I do this? I know how to create a data entry form that puts data in one table but don't know how to put it in two tables while maintaining the relationship. I would really appreciate a screenshot.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你对谁都笑 2024-12-26 06:17:18

假设每个学生可以有 0 到多门课程,您应该在数据输入表单上创建一个子表单,并列出每个学生的课程。

听起来您正在使用 Access Forms 设计器(而不是 VBA 代码)执行此操作:

  1. 创建一个名为 frmStudents 的主窗体。
  2. 将此表单的数据源设置为您的学生表,然后添加要显示的字段(您可以从“可用字段”菜单中拖动这些字段。

  3. 创建另一个名为 sfmCourses 的表单,并将数据源设置为您的课程表。将此表单的默认视图设置为连续表单或数据表。在设计视图中,您仍然会看到标准表单设计器视图。将您想要使用的字段拖放到表单上并进行排列以适合。

  4. 向 frmStudents 添加一个子表单容器,并将 SourceObject 属性设置为 sfmCourses。然后使用 LinkMasterFields 属性建立两者之间的关系。

希望有帮助。

Assuming that each student can have 0 to many courses, you should create a subform on your data entry form with the courses for each student listed.

It sounds like you are doing this using the Access Forms designer (as opposed to VBA code):

  1. Create a main form named frmStudents.
  2. Set the datasource for this form to your students table, and then add the fields you want displayed (You can drag these from the "available fields) menu.

  3. Create another form named sfmCourses and set the datasource to your courses table. Set the default view for this form to either continuaous forms or Datasheet. While in design view you will still see a standard forms designer view. Drag and drop the fields you want available onto the form and arrange to suit.

  4. Add a Subform container to frmStudents and set the SourceObject property to sfmCourses. Then use the LinkMasterFields property to establish the relationship between the two.

Hope that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文