如何在Access 2010中创建自定义ID [英] How to Create a Custom ID in Access 2010

查看:226
本文介绍了如何在Access 2010中创建自定义ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题的标题可能不准确,因为我不确定如何提出该问题.

The title of this Question may not be accurate because I wasn't sure how to ask the question.

是否有具有在2010年AC的ID字段的方式具有恒定的部分,然后将ID的一部分,用户将进入?

Is there A way to have an ID field in AC 2010 the has a constant part and then a part of the ID that the user will enter in?

实施例: EMP9066"

EXAMPLE: "EMP9066"

-I希望ID的EMP"部分在所有时间保持恒定,并且用户不应该能够改变它与9066"是一个四位,该用户将被要求在键入.

-I would like the "EMP" part of the ID to be constant at all times and the user should not be able to change it and the "9066" is a four digit that the user will be asked to type in.

请帮助.

_记住,这是不是SQL有一些宏只是基本的访问.

_ Remember this is not SQL just basic access with some macros.

谢谢

推荐答案

访问具有数据类型称为自动编号,它会自动生成每个记录的唯一的号码,但它不允许阿尔法前缀.

Access has a data type called autonumber which will generate a unique number for each record automatically but it does not allow for the alpha prefix.

如果它确实是常量,那么最简单的方法是在其前面显示前缀,即在表中该字段称为recId(例如),您将通过具有已计算列的查询查看行

if it is indeed constant then the simplest approach is to prefix with it for display, ie in the table the field would be called recId (for example) and you would view the rows via a query with a calculated column

EmpId:"EMP"和格式$(RecId,"0000")

EmpId: "EMP" & format$(RecId,"0000")

这篇关于如何在Access 2010中创建自定义ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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