How to append running number

B

Boon

Hello,

I have a table A. the first field in table A is called ID. the data type is
integer.

I have created a query. In this query I would like to be able to append data
in to table A, with one specific thing. I would like to be able to append
the row number to column ID in table A.

For intance, if table A is empty, and I apeend 10 records to table A, I want
column ID to have number 1 through 10 when appending.

if table A has 20 records. and I append 10 records to table A, I want column
ID to have number 21 through 30 for my newly appending records.



thanks!
Boon
 
L

Lynn Trapp

Does this ID number have to be sequential, without any gaps? If not, you
should consider using an AutoNumber field for that field. If yes, you will
probably need to write a vba function to accomplish what you want.
 
K

KenSheridan via AccessMonster.com

Boon:

If there really is a good reason for having an unbroken sequence you'll need
to compute them as an autonumber only guarantees unique values, not
necessarily sequential ones, which in turn means data entry must be via a
form (which it should be in any case). For two approaches, both of which
prevent the conflicts which are possible in a multi-user environment, see the
following links. The second, slightly more complex, solution also allows the
next number to be used in the sequence to be 'seeded':

http://www.rogersaccesslibrary.com/...?TID=395&SID=83z7c11zc7b721d2a1e51989c53d7ffb


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

Top