自动编号错误 [英] Autonumber counts wrong

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

问题描述


我有一个表(mdb,access 2010) 带有自动编号字段(不是主键,索引没有重复)。

大约有4000个数据集,最大自动编号是11643.

当我尝试插入新数据集时,自动编号字段创建数字10000 - 因此我在保存数据集时出错(重复)索引值)。


我试图用$
来重置计数器CurrentDb.Execute" ALTER TABLE tblBewerber ALTER COLUMN ProfilNummer COUNTER(11644,1)" / p>

这有效,但是当我压缩数据库时,问题再次发生。

我读了知识库文章KB884185,但这并不完全相同的行为和解决方法不行。


我尝试了一些观点:


  1. 将数据类型autonumber更改为长整数并创建一个新的自动编号字段。

    新字段具有相同的错误。
  2. 我创建了一个新表,并从旧表中复制了字段定义。

    然后我首先使用复制/粘贴从旧表中插入数据集,然后使用追加查询。

    两者都不起作用。最后,我尝试了一个创建查询 - 这也没有用。

当我压缩数据库并且实际的下一个自动编号大于11644(MaxID + 1)时,总是(1或100次尝试中的例外) ,$
Access给我一个10000的自动编号。


错误发生在3台不同的计算机(XP,Windows7)上,有3个不同版本(14.0.4760.1000) / 14.0.5128.5000 / 14.0.6023.1000(全部32位))

有时只有创建的错误数字不同。


我希望你能给我一些帮助,因为我不想创建一个包含大量数据,表格和关系的完整新数据库。

我不确定,如果这会有所帮助,因为我无法重现错误,当我在新创建的表中插入新数据集时。

是否可能,错误来自损坏的数据集?


_____________________


uvju


 

解决方案

嗨uvju,


直到现在我的经验是Auton umber非常强大,永远不会出错!


但是使用INSERT语句,您可以设置自己的自动编号。因此,请仔细查看是否存在问题来源。


 


Imb。


Hi,

i have a table (mdb, access 2010) with an autonumber field (not primary key, index without duplicates).
There are about 4000 datasets, maximum autonumber is 11643.
When i try to insert a new dataset, the autonumber field creates number 10000 - and so i get an error when saving the dataset (duplicate index values).

I tried to reset the counter with
CurrentDb.Execute "ALTER TABLE tblBewerber ALTER COLUMN ProfilNummer COUNTER(11644,1)"

This works, but when i compress the database, the problem occurs again.
I read knowledgebase-article KB884185, but thats not exact the same behavier and the workaround doesn't work.

I tried some points:

  1. change datatype autonumber to long integer and create a new autonumber field.
    the new field has the same error.
  2. i created a new table, and copied the field-definitions from the old table.
    Then i inserted the datasets from the old table first with copy/paste, then with an append query.
    Both didn't work. At last i tried with a create query - this didn't work too.

Always (1 or to exception in 100 tries maybe) when i compress the database and the actual next autonumber is bigger then 11644 (MaxID+1),
Access gives me an autonumber of 10000.

The error occurs on 3 different computers (XP, Windows7) with 3 different versions (14.0.4760.1000 / 14.0.5128.5000 / 14.0.6023.1000 (All 32-Bit))
Only the created wrong numbers differ sometimes.

I hope you can give me some help, because i don't want to create a complete new database with a lot of data, tables and relationships.
And I'm not sure, if this would help, because i can't reproduce the error, when I insert new datasets in the new created table.
Is it possible, that the error comes from a corrupted dataset ?

_____________________

uvju

 

解决方案

Hi uvju,

My experience until now is that the Autonumber is very robust, and never goes wrong!

But with an INSERT statement you can set your own Autonumber. So look carefully if there the source is of your problem.

 

Imb.


这篇关于自动编号错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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