且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Access 2010中创建自定义ID

更新时间:2023-02-12 08:37:38

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

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")