How to Create a Custom ID in Access 2010

你离开我真会死。 提交于 2019-12-02 11:51:56

问题


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

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?

EXAMPLE: "EMP9066"

-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.

Please Help.

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

Thanks


回答1:


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.

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" & format$(RecId,"0000")



来源:https://stackoverflow.com/questions/8829271/how-to-create-a-custom-id-in-access-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!