A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

autonum keyfield



 
 
Thread Tools Display Modes
  #1  
Old November 21st, 2004, 09:56 PM
WWV
external usenet poster
 
Posts: n/a
Default autonum keyfield

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


  #2  
Old November 21st, 2004, 10:18 PM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Sun, 21 Nov 2004 15:56:37 -0500, "WWV" wrote:

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
  #3  
Old November 24th, 2004, 01:01 AM
Glen Bodie
external usenet poster
 
Posts: n/a
Default

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.

"WWV" wrote:

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


  #5  
Old November 24th, 2004, 02:09 PM
Lynn Trapp
external usenet poster
 
Posts: n/a
Default

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."

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


"Glen Bodie" Glen wrote in message
...
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.

"WWV" wrote:

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




  #6  
Old November 24th, 2004, 06:32 PM
Tim Ferguson
external usenet poster
 
Posts: n/a
Default

John Vinson wrote in
:

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

  #7  
Old November 24th, 2004, 07:00 PM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Wed, 24 Nov 2004 09:32:18 -0800, Tim Ferguson
wrote:

John Vinson wrote in
:

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.


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
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.