开发者

Autonumber - specify starting point

MS Access 2007

I'm trying to start AutoNumber at 5,000 and increase it by 9 for each entry. Is there any way 开发者_JS百科to do this? It doesn't have to be with AutoNumber, if there is another way in Access to do this, that would be great too. Please help.


You can use DDL under ADO to set the autonumber seed and increment. (However, echoing @mwolfe02's comment ... why?)

Dim strSql as String
strSql = "ALTER TABLE YourTable ALTER COLUMN YourAutoNumberColumn COUNTER(5000, 9)"
CurrentProject.Connection.Execute strSql

Also see if this previous Stack Overflow question is useful to you: How to reset autonumber seed - MS Access/VB6


I cannot think of why one would need such a beast.

But you could use a "normal" AutoNumber that starts at 1 and increases by 1 and just show (and use) the computed column:

FakeAutoNumber = (AutoNumber * 9) + 4991
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜