如何通过表单向表中添加多个记录? [英] How to add multiple records to a table via a form?

查看:112
本文介绍了如何通过表单向表中添加多个记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上周我是Access的初学者,所以请原谅我无法理解Access;目前我在Access 2013上。我正在尝试将多个记录添加到表中。例如,我有多名员工参加培训,而不是一个一个地输入,有没有办法输入所有去过的员工?我尝试在表单中创建一个列表框,使用多选来选择参加的员工,然后添加但它似乎不起作用。所以我有一个表是Employee和他们的ID#,另一个表指示员工去过哪些培训/培训名称,费用,日期和收据附件。后来我计划进行查询以获得每个人参加的培训数量以及每个员工花费的金额总和。

I am a beginner in Access as of last week, so pardon my inability to understand Access; currently I am on Access 2013. I am trying to add multiple records to a table. For example, I have multiple employees going to a training so instead of inputting them one by one, is there a way to input into all the employees that did go? I attempted in a form to make a list box, use multi select to select the employees that attended, and then add but it did not seem to work. So I have one table that is Employee and their ID # and another table that indicates which trainings employees have gone to/training name, the costs, the date, and receipt attachment. Later I am planning to make a query to get how many trainings each has attended and the sum of the amount spent on each Employee.

推荐答案

beginneraccess


欢迎使用Bytes!


您还应该有一个EmployeeTraining Table,其中包含培训课程和参加培训的员工。


有很多方法可以将这些员工添加到此表中。这取决于你想要的精巧程度。


一种方法是获得一个表格。在该表格上,您可以选择培训课程。选择课程后,该主表单上会有一个子表单列出该课程的所有与会者,以及一个包含所有未参加该课程的员工的组合框。从该组合框中选择一名员工,单击命令按钮将该人员添加到该课程。按钮后面是VBA,可以将人员添加到课程中,并重新查询子窗体和组合框。你也可以使用你所描述的列表框来允许一次选择多个员工。


这是 one 做到这一点的方法,但不是答案本身。我们不能为你做那件事。但是,我们很高兴能够一步一步地完成细节并解决您遇到的任何特定问题。


希望这个hepps!
beginneraccess

Welcome to Bytes!

You should also have an EmployeeTraining Table, which has the Training Course and the Employees who attended that training.

There many ways to add these employees to this table. It just depends on how elaborate you want to make it.

One way is to have a Form. On that form, you select the training course. Once you select the course, there would be a subform on that main form that lists all the attendees for that course, as well as a combo box that holds all the employees who have not attended that course. Select an employee from that combo box, click a command button to add the person to the course. Behind the button is VBA to add the person to the course and requery both the subform and the Combo Box. You could also use a List box as you have described to allow selecting multiple employees at once.

This is an outline of one way to do it, but not the answer itself. We can''t do that for you. However, we are glad to work through details one step at a time and troubleshoot any sepcific problems you come across.

Hope this hepps!


亲爱的twinnyfo,


感谢您的快速回复。到目前为止,我已经创建了一个表单和一个子表单,可以选择多个员工并添加到子表单中。然而,尽管选择了多名员工,但似乎只增加了一名员工。请问这是第一个表单错误还是子表单错误?

Dear twinnyfo,

thank you for your quick response. So far I have created a form and a subform which made it possible to select multiple employees and add to the subform. However, despite selecting multiple employees it seems to only add to one employee. May I ask if this is the first form error or the subform error?

附加图像
screenshoot.PNG (16.1 KB,287次观看次数)
Attached Images
screenshoot.PNG (16.1 KB, 287 views)


什么是VBA您正在使用将记录复制到第二个表。这是我们的起点。
What is the VBA you are using to copy the records to the second table. That is our starting place.


这篇关于如何通过表单向表中添加多个记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆