问题
A form that I have at the moment has the field, Skill_Name
.
There is a subform with two fields; Employee_ID
(A combo box of all Employee_IDs) and 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
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.
Regards, AUS_Doug.
回答1:
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
来源:https://stackoverflow.com/questions/21692369/ms-access-setting-default-value-of-a-field-to-be-the-values-of-two-other-field