Create column with number that increases by 1

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

Guest

Hi,

I have a table, I want to add another column with that starts with 1 and
increases by 1 each row. 1,2,3....

Is there a formula I can use?

Thanks for your help.
 
An autonumber column is designed only to guarantee unique values, not
necessarily sequential ones. Moreover, if a user abandons adding a new
record then the autonumber value will not be reused unless the database is
compacted before adding the next record.

In a single user environment you can easily generate the next number in
sequence, but this must be done in a form not in raw datasheet view of the
table. This is no disadvantage as in any application worth the name data
should never be inserted into a table in raw datasheet view, but always via
forms.

In the form's BeforeInsert event procedure look up the last number and add
1, e.g.

[MyNumber]=Dmax("[MyNumber]","[MyTable]")+1

In a multi-user environment on a network its more complex as two users
adding records simultaneously could give rise to a conflict as both would get
the same number. There are various ways around this. One can be found at
the following link, which also allows the number from which the sequence will
start when the next record is added can be reset:


http://community.netscape.com/n/pfx...yMessages&tsn=1&tid=23839&webtag=ws-msdevapps


Ken Sheridan
Stafford, England
 

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