fixed-length autonumber

K

Kyle

I am using an autonumber field as the primary key in my database, which
will be the Unit ID for a number of freezers (500-2000) we will track
with the database. Since we'll be posting this IDs on the units, I
would like to have an ID of a fixed length of five characters, "H00027"
for example.

Now, I know I can't get Autonumber to do the letter prefix, so I will
be putting that into a separate field. But is there a way to force
Autonumber to display not as a simple integer, but of a fixed length
like that?

If not, what is my best, and simplest, workaround for this?

Thanks!
 
D

Douglas J Steele

If you're going to use an Autonumber, Formatting it is the only option you
have. To ensure 5 digits, set its Format property to 00000.
 
K

Kyle

Gee, I'm such a twit. Why didn't I think of that? Of course, setting
the Format to require five digits would cause Autonumber to generate
leading zeros...

And, yeah, I'm going to use Autonumber because it streamlines the
database for whoever takes it over once I'm gone (I'm just a contract
person) and those administering the database when I leave won't be
advanced users who could adjust the code as necessary.

Thanks, Doug!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top