autonum keyfield

W

WWV

I was worrking with a clients db and without going into details, they issued
2 new records in a table then I restored it. I need to put these records in
and generate 2 new records in a table with autonum field. There are 2 "open"
places for the records but I don't if it's possible to force add them and
PUT IN THE NUMBER I WANT? Can anyone tell me if this can be done?
ie. NUM existing 100 104 105 can I force 102 and 103?
THANKS
WWV
 
J

John Vinson

I was worrking with a clients db and without going into details, they issued
2 new records in a table then I restored it. I need to put these records in
and generate 2 new records in a table with autonum field. There are 2 "open"
places for the records but I don't if it's possible to force add them and
PUT IN THE NUMBER I WANT? Can anyone tell me if this can be done?
ie. NUM existing 100 104 105 can I force 102 and 103?

By NOT using an Autonumber.

An Autonumber field has one purpose, and one purpose ONLY: to provide
a guaranteed-unique key. Autonumbers are intentionally NOT editable or
controllable. If you care what the value is, or want to see it, you
should use a Long Integer field instead, and maintain its value
manually or in VBA code.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
G

Glen Bodie

In the Table Design change the Autonum field to a Long Integer, make the
changes you want in the field values, change back to AutoNum.
 
A

Armen Stein

"=?Utf- said:
In the Table Design change the Autonum field to a Long Integer, make the
changes you want in the field values, change back to AutoNum.

You can also use an Append Query. It will let you assign an Autonumber
field value.

But I agree with John Vinson - why do you care what number it is? If
you don't want gaps in values, then you shouldn't use Autonumber,
because gaps will inevitably show up.

--
Armen Stein
Access 2003 VBA Programmer's Reference
http://www.amazon.com/exec/obidos/ASIN/0764559036/jstreettech-20
J Street Technology, Inc.
Armen _@_ JStreetTech _._ com
 
L

Lynn Trapp

In the Table Design change the Autonum field to a Long Integer, make the
changes you want in the field values, change back to AutoNum.

Glen,
That won't work. Attempting to change the field back to AutoNumber will
generate the following error: "Once you enter data in a table, you can't
change the data type of any field to AutoNumber, even if you haven't yet
added data to that field."
 
T

Tim Ferguson

If you care what the value is, or want to see it, you
should use a Long Integer field instead, and maintain its value
manually or in VBA code.

To be fair, John, I read the OP message as wanting to restore two records
that had been accidentally lost. If the autonumber has been propagated onto
other records (eg paper forms, remote database, spreadsheet etc) then it's
reasonable to want to put them back as they were. It's not necessarily a
cosmetic don't-want-gaps-in-the-numbers scenario.

B Wishes


Tim F
 
J

John Vinson

To be fair, John, I read the OP message as wanting to restore two records
that had been accidentally lost. If the autonumber has been propagated onto
other records (eg paper forms, remote database, spreadsheet etc) then it's
reasonable to want to put them back as they were. It's not necessarily a
cosmetic don't-want-gaps-in-the-numbers scenario.

Good point Tim! I wasn't thinking the question through and just
dropped into autopilot.


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 

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

Similar Threads


Top