autonumber problems

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

Guest

ive just imported some data from excel to an existing table which already has
some data in it. The primary key is an autonumber which has the format of
"COMP" @@, sofar ive had what i wanted which has been numbers of COMP 1, COMP
2 etc. but the newly imported data has suddenly gone to 7510COMP7906. Is
there any reason for this and can it be changed to the old format?
 
The reason that the number is splitting around the COMP is that you only have
2 ampersands. Try something like this:

"COMP "@@@@@@@@@
 
it moves the numbers to the end but still is a much bigger number. the data
that was already there goes to COMP 151 and then the imported stuff goes
straight to COMP 75107857. Is there anyway to make it continue from 151?
 
Not directly. You would have to import the data into another table or link to
the Excel spreadsheet. Then you could pour the data into the table using an
append query.

HOWEVER (shouting on purpose) there is no guarantee that the next autonumber
would be sequential. Autonumbers that are primary keys are only guaranteed to
be unique and not follow any pattern. You would need to create a function to
create sequential numbers during the insert.
 

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