在Access 2010+中自动生成ID + 4位数的序列号 [英] Automatically generate Date + 4-digit sequence number for ID in Access 2010+
问题描述
我需要为我的商业密钥自动生成一个12个字符的值。没有任何用户交互。
I need to automatically generate a 12 character value for my Business Key. Without any user interaction.
8 character -> Today Date (yyyymmdd or ddmmyyyy).
+
4 character -> Sequential Number (0001,0002,0003).
顺序号码必须在每一个新的一天重置。
The Sequential Number must reset on each new day.
是否可以在Microsoft Access 2010+中执行此操作,而不需要编码?
Is it possible to do this in Microsoft Access 2010+ without any coding involved?
推荐答案
由于您正在使用Access 2010+最好的方式来完成你的目标是使用一个这样的改变前数据宏
Since you are using Access 2010+ the best way to accomplish your goal would be to use a Before Change data macro like this
要创建更改前的宏,请单击更改前按钮,在表选项卡上表格在数据表视图中打开时的功能区:
To create the Before Change macro, click the "Before Change" button on the "Table" tab of the ribbon when the table is open in Datasheet View:
有关数据宏的更多详细信息,请参阅
For more details on Data Macros see
这篇关于在Access 2010+中自动生成ID + 4位数的序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!