Autonumber

M

Milindra

I set my EmployeeID field as a Autonumber. Let say the
now the number runs from 1 to 10, but now I want to
delete three of them. Since it was setup as Autonumber so
when I add a new Employee, it will automatically generate
Employee number 11 instead of 8.

Is there anyway that I can program Autonumber to see
Maximum record and plus 1 so that it will has a right ID
number.

Thanks in advance,
Milindra
 
F

fredg

I set my EmployeeID field as a Autonumber. Let say the
now the number runs from 1 to 10, but now I want to
delete three of them. Since it was setup as Autonumber so
when I add a new Employee, it will automatically generate
Employee number 11 instead of 8.

Is there anyway that I can program Autonumber to see
Maximum record and plus 1 so that it will has a right ID
number.

Thanks in advance,
Milindra

You are miss-using the Autonumber field if you use it for any purpose
other than being a unique number.

If you feel you must number records in a consecutive order, you'll
need to make your own ordering system.
Set the Default value of the field to
=DMax("[FieldName]","TableName")+1

But then if you later delete record #50 out of 75, you will still be
missing that one number.
 
J

Jonathan Parminter

Hi Milindra,
by definition you are unable to edit an autonumber
datatype. You can fill-in 'missing' numbers using an
append query. But you must be careful to avoid problems if
there are related records from previously deleted records
with the same id.

Luck
Jonathan
 
M

Milindra

Many thanks to all of you. This help me a lot.

Milindra
-----Original Message-----
I set my EmployeeID field as a Autonumber. Let say the
now the number runs from 1 to 10, but now I want to
delete three of them. Since it was setup as Autonumber so
when I add a new Employee, it will automatically generate
Employee number 11 instead of 8.

Is there anyway that I can program Autonumber to see
Maximum record and plus 1 so that it will has a right ID
number.

Thanks in advance,
Milindra

You are miss-using the Autonumber field if you use it for any purpose
other than being a unique number.

If you feel you must number records in a consecutive order, you'll
need to make your own ordering system.
Set the Default value of the field to
=DMax("[FieldName]","TableName")+1

But then if you later delete record #50 out of 75, you will still be
missing that one number.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
 

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