[英]How can I get a second field to auto populate based on the selection of the first field in Access 2013?
I am trying to build a training record database.我正在尝试建立一个培训记录数据库。 In our company, employees have to take a variety of different training and each certification has a different expiry timeline.
在我们公司,员工必须接受各种不同的培训,每个认证都有不同的到期时间。
My first table lists out ALL the training along with the number of days they are valid for like so:我的第一个表格列出了所有培训以及它们的有效天数,如下所示:
My second table will simply list out all the employees and each of their training and the date they took it.我的第二个表格将简单地列出所有员工和他们接受的每项培训以及他们接受培训的日期。
For ex:例如:
How can I get a forth field, to automatically calculate the Expiry date, based off of the number of days the certification is valid in the first table?如何根据第一个表中认证的有效天数获得第四个字段以自动计算到期日期?
You need the DateAdd
function like this:您需要像这样的
DateAdd
函数:
DateAdd("d",[NoOfdays],[TrainingDate])
How you will use that depends on what you are trying to do.您将如何使用它取决于您要尝试做什么。 If you just want to have it somewhere create a query that links the two tables together based on employee and add the above as a field.
如果您只是想让它在某处创建一个查询,该查询根据员工将两个表链接在一起,并将上述内容添加为一个字段。
If you don't want to link the tables you can use DLookup
to read the [NoOfDays]
field like this:如果您不想链接表,您可以使用
DLookup
读取[NoOfDays]
字段,如下所示:
DLookup("[NoOfdays]","[TrainingTable]","[TrainingCourse]=" & [TrainingCourse])
Since you don't provide the table or field names, or whether your tables are properly structured with IDs or not that's as far as I can get you.由于您不提供表或字段名称,或者您的表是否使用 ID 正确构建,因此我只能为您提供。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.