在 Access 2010+ 中为 ID 自动生成日期 + 4 位序列号 [英] Automatically generate Date + 4-digit sequence number for ID in Access 2010+

查看:52
本文介绍了在 Access 2010+ 中为 ID 自动生成日期 + 4 位序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为我的业务密钥自动生成一个 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+,实现目标的最佳方法是使用像这样的 Before Change 数据宏

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屋!

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