MS Access-将字段的默认值设置为其他两个字段的值,以"_"分隔 [英] MS Access - Setting default value of a field to be the values of two other fields, seperated by an'_'

查看:270
本文介绍了MS Access-将字段的默认值设置为其他两个字段的值,以"_"分隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前拥有的一个表单的字段为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屋!

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