MS Access 2003中 - 为表自定义自动编号的ID? [英] MS Access 2003 - Customized Auto-Number IDs for tables?
问题描述
有没有一种方式,使用像一个自动编号的表我自己的号码;这是自动分配下一个可用的一个新纪录。我们有,我要扎到这个数据库中每个员工的系统ID号。我只是想表自动分配一个号码。
Is there a way to use my own number in a table like an auto-number; that is to automatically assign the next available to a new record. We have system ID numbers for each employee that I want to tie into this database. I just want the table to auto assign the next number.
我能做到这一点? 难道这与数字和字母的混合做? 难道标准来使用,比如code A =某组号码,code B =另一个?
Can I do this? Could this be done with a mixture of numeric and alpha? Could criteria be used, like Code A = certain set of numbers, Code B = another?
谢谢!
推荐答案
当然可以,但你必须要设计这个自己。
Of course you can, but you will have to design this yourself.
有数百这样做,但是,这样的方式可能是,你可能有一个参数表nextQuote,nextEmployeeNo,nextJob......当然,你的表的设计可以有任何东西,包括preFIX例子;
There are hundreds of ways of doing this but on way might be that you may have a parameters table with "nextQuote", "nextEmployeeNo", "nextJob"... of course your table design could have anything, including prefix example;
PARAMETERS
Prefix Number
Q 1145
E 54
J 999
所以现在你可以 SELECT preFIX + MAX(号码)NextEmployee FROM参数,其中,preFIX = E
而在你的code可以处理后增加的数量。
And in your code you can increment the number after dealing with it.
UPDATE Parameters SET Number = number + 1 WHERE Prefix = E
如果这是达不到的工作,然后希望它会得到你如何可以做同样的事情的想法。
If this isn't up to the job then hopefully it will get you thinking in how you can do something similar.
希望这有助于。
这篇关于MS Access 2003中 - 为表自定义自动编号的ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!