MS Access-将字段的默认值设置为其他两个字段的值,以"_"分隔 [英] MS Access - Setting default value of a field to be the values of two other fields, seperated by an'_'
问题描述
我目前拥有的一个表单的字段为Skill_Name
.
A form that I have at the moment has the field, Skill_Name
.
有一个包含两个字段的子窗体; Employee_ID
(所有Employee_ID的组合框)和Emp_Skill_ID
.
There is a subform with two fields; Employee_ID
(A combo box of all Employee_IDs) and Emp_Skill_ID
.
选择Employee_ID
后,我希望Emp_Skill_ID
以以下格式自动填充:
Upon selecting an Employee_ID
, I'd like the Emp_Skill_ID
to autofill in the following format:
Employee_ID
_ Skill_Name
示例:If Employee ID = 1234567, and Skill Name = AutoElec
,
我希望Emp_Skill_ID
自动成为1234567_AutoElec
.
Example: If Employee ID = 1234567, and Skill Name = AutoElec
,
I want the Emp_Skill_ID
to automatically be 1234567_AutoElec
.
如果有可能的话,如果有人可以告诉我该怎么做,将不胜感激.
If that's at all possible, it'd be much appreciated if someone could tell me how to do it.
关于, AUS_Doug.
Regards, AUS_Doug.
推荐答案
,您需要同时处理Employee_ID和SkillName中的AfterUpdate.像
you need to handle the AfterUpdate in both Employee_ID and SkillName. Something like
Private Sub Employee_ID_AfterUpdate()
UpdateEmp_Skill_ID
End Sub
Private Sub SkillName_AfterUpdate()
UpdateEmp_Skill_ID
End Sub
Private Sub UpdateEmp_Skill_ID
If Not IsNull(Employee_ID) And Not IsNull(SkillName) Then
Emp_Skill_ID = Employee_ID & "_" & SkillName
End If
End Sub
这篇关于MS Access-将字段的默认值设置为其他两个字段的值,以"_"分隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!