How format field in Access so pc generates alphanum response.

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

Guest

How do I format a field in Microsoft Access so the computer generates an
alphanumeric response...What I need is to figure out how to have the primary
key in a table to be a customer number that starts with C and then has 6
digits after...and it needs to be an autogenerating thing,so the pc does it
automatically...Please help!
 
Not an expert here but I "think" you can use
\C#
in the format section of the field in table design. I tried and it seemed to
work. I got results like:
C1
C2
C3...

Thought this is what you are asking for.

Alp
 
If the prefix letter is always the same, then you do not need to store it at
all. Make your CustomerNumber field numeric (either a Long integer or an
AutoNumber).

Whenever you *display* the number on a form or report, you can set the
Format property of your textbox to:
\C000000

This will show it as a "C" followed by 6 digits.

If it is an Autonumber then new numbers will be generated automatically, but
you may get some gaps. If that is a problem then you must use some code to
ascertain the next available number. The simplest way is to use DMax:

NextNumber = Nz( DMax( "CustomerNumber", "CustomerTable" ), 0) + 1
 

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

Back
Top