Auto number

  • Thread starter Thread starter Randy Kohler
  • Start date Start date
R

Randy Kohler

Hello,

I'm looking to see if it is possible to add a autonumber using a format like
this...

2004-0001
2004-0002
2004-0003
2004-0004
2004-0005

I'd like the first part of the number to stay the same 2004. then have only
the last four numbers autogenerate.

I can get it to work going the other way like:

0001-2004
0002-2004
0003-2004
0004-2004
0005-2004

but not with the first nubers before the ( - ) dash.
any suggestions???

thanks in advance,
 
Randy,

It is extremely unlikely that there is any good reason to do it this
way. You are trying to store 2 pieces of information in the one field,
which is almost certainly a bad idea. You should make 2 fields, keep
the 2004 in one and then use an AutoNumber data type field for the
other, and let Access autogenerate the number for you. Since this is in
the table, and you don't normally look at the data in a table, it
doesn't matter what it looks like. And where it does matter what it
looks like (i.e. forms and reports), it is very easy to display it as
you require, using an expression in a calculated field in the query, or
a calculated control on the form or report. The syntax will be
something like the equivalent of this...
[YourNumberField] & "-" & Format([YourAutonumberField],"0000")

Or, will the prefix part of your code number *always* be 2004? If so,
just have an Autonumber field, drop the other one, and display it as
required by setting the Format property of the control on your forms and
reports like this...
"2004-"0000
 

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