irunergoiam
10-08-2009, 07:55 AM
I would like to use the autonumber data type (with New Values selected as Random) to create a unique identifier for temporary staff. There are two changes I wish to make to this number:
1) limit the length of the random number to numeric characters (the default is 10.
2) add a "t" prefix to distinguish this number for "temporary" staff. Is there another way other than concantenating in a query?
Thanks much for any guidance you guys might offer.
irunergoiam
10-08-2009, 11:17 AM
In my haste to post, I neglected a few details:
1) limit the length of the random number to 6 numeric characters (the default is 10).
2) add a "t" prefix to distinguish this number for "temporary" staff. Is there another way other than concantenating in a query?
Mr. B
10-08-2009, 12:58 PM
You will have to generate this type of value on your own as Access does not provide any way to modify or format the AutoNumber type field.
Fisher31
10-08-2009, 01:40 PM
I am trying to do something simular (with the prefix letter) and I found a simple way of doing this by entering say "T"000 into the caption box in the field properties in the table design veiw.
I hope this makes sense
boblarson
10-08-2009, 01:48 PM
To both irunergoiam and Fisher31 -
Do not use autonumbers for meaningful purposes. You WILL get burned at some point. Autonumbers are guaranteed to give you a UNIQUE number. They are not guaranteed to go in consecutive order (even if you do have that property set) and they are not guaranteed to always be positive numbers. Autonumbers should really only be used for "behind-the-scenes" stuff. If you have need of a specific number with meaning, use a different method (the DMax + 1 for example).