访问记录的随机唯一编号 [英] Random unique numbers for access records

查看:68
本文介绍了访问记录的随机唯一编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个访问表,其记录在一个字段中具有唯一编号。我想复制除了唯一编号之外的记录,并且在复制时我想给出不同的编号。

我找到了一个可以生成随机数的代码,但我不知道在哪里放入它单击按钮创建重复记录并交叉检查表格以查找已使用的数字。

我通过绑定表单按钮单击复制记录,事件如下:任何人都帮我重新安排或修改代码来实现结果。提前谢谢

I have an access table with records having unique numbers in one field. I would like to duplicate the record except the unique number and while duplicating I like to give a different number.
I have found a code which can generate the random numbers but I dont know where to put it in the button click which creates the duplicate record and cross check the table to find wether the number has been already used.
I am duplicating the record through a bound form button click and the event is as below: Can anyone help me to re arrange or modify the code to achieve the result. Thank you in advance

展开 | 选择 | Wrap | 行号

推荐答案

我甚至没看你的代码,但你有一个自动编号主键字段?我想下一个问题是你可以在同一个表中创建一个重复的记录吗?
I didn''t even look at your code yet, but do you have an auto-number primary key field? I guess the next question is can you create a duplicate record in the same table?


这些记录实际上是从日志文件中导入的。并且日志文件具有唯一的数字字段。我有时需要创建相同的记录,但表格不允许复制唯一的数字。这就是我想先生成一个随机数的原因,然后在表中检查数字是否存在,如果存在则生成另一个数字并保存记录。保存记录后,表单重新查询并显示上次保存的记录(重复记录)
The records are actually imported from a log file. And the log file has a number field which is unique. I need to create the same record sometimes but the table wont allow duplicate for the unique number. That is the reason i want to generate a random number first, then check in the table whether the number exists, if exists then generate another number and save the record. After saving the record, form to requery and show the last saved record (duplicate record)


您可以在设计视图中将字段选项更改为索引(重复确定) ?它可能已设置为无重复,即使您的应用程序可能不需要这样做。
Can you change the option for the field to ''indexed(duplicates ok)'' in design view? It might be set to ''no duplicates'' already even though that might not be necessary for your application.


这篇关于访问记录的随机唯一编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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