Autonumber Field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way to have an autonumber field include text as well as numbers?
The reason I ask is because I am trying to have the autonumber include a
prefix letter before it. Can this be done?
 
Is there any way to have an autonumber field include text as well as
numbers?

No. An AutoNumber field will increment the seed by one to get the next
number to assign the next new record (unless you're using an increment other
than the default or a non-incrementing AutoNumber).
I am trying to have the autonumber include a
prefix letter before it. Can this be done?

Use two fields to calculate the value in a query or in VBA. For example:

SELECT (Prefix & ID) AS Ident
FROM tblMyTable;

Or in VBA:

Me!txtIdent.Value = Me!txtPrefix.Value & Me!txtID.Value

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
Secret said:
Is there any way to have an autonumber field include text as well as
numbers? The reason I ask is because I am trying to have the
autonumber include a prefix letter before it. Can this be done?

I would like to add to Camaro's accurate comments.

I suggest you may not want to use Autonumber for that use. Autonumbers are
designed to provide unique numbers. It in not designed to provide numbers
in order and for a number of reasons may not do so. As a result using them
in any application where the user sees the numbers is likely to end up with
confusion.

There are other ways of providing the numbers you want depending on the
particual application.
 
Is there any way to have an autonumber field include text as well as numbers?
The reason I ask is because I am trying to have the autonumber include a
prefix letter before it. Can this be done?

In addition to Gunney's suggestion - if the prefix letter is always
the same, simply use the field's Format property to include it; a
format of

"A000000"

will display the numbers like A001285.

Note that Autonumbers are not really suitable for human-readable
identifiers; they'll always have gaps, and can become random.

John W. Vinson[MVP]
 
Back
Top