Auto Number

M

mahesh

Can an auto-number field in a table be started from a
specified value ? I mean, I want an auto-number field to
be started from 100. How can it be ? Can you please let
me know ?
 
J

Jeff Boyce

Mahesh

The Access Autonumber data type works quite well to generate a unique row
identifier, but is rarely suitable for "human consumption". The fact that
you wish to start Autonumber-ing at a specific value suggests that you are
trying to use it for a purpose other than it was designed.

If you need a numbering field that you can control, you'll need to create
both the field and a simple routine - check either Google.com or the
mvps.org website for "custom autonumber".

Good luck

Jeff Boyce
<Access MVP>
 
D

Douglas J. Steele

Actually, Jeff, I think this one's semi-legitimate. Say you've got data
already from another source, but you want to use an AutoNumber for all of
your new data. If you append the existing table to the table with an
AutoNumber, it'll plug the existing values into the AutoNumber field, and
start incrementing at the next available number.
 
J

Jeff Boyce

On point, Doug. An "append to existing" situation would make sense to start
Autonumbering at a specified point. I hadn't read the original post that
way...

Jeff Boyce
<Access MVP>
 
M

Mikezcg

Yes, you can.. to do this:
Create the first table that contains the counter type
field that you want to start on another number. Don't
enter any records.Create a second table, with a single
long integer number type field that has the same name as
the counter field in the first table. Create a record in
the second table by entering a number one less than the
number you want to start the counter at in the first
table. Create an append query, to append the one record in
the second table to the first table, and run it Delete the
second table, delete the record that you appended to the
first table, and start entering data.

Alternative method:

You can make an Append query that just appends a value
from a parameter, to just the auto-number field (as long
as no other fields are required), e.g.:

PARAMETERS [Number] Long;
INSERT INTO tblAuto ( intNumber )
SELECT [Number] AS Expr1;
 

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