How to add a value to an autonumber field? (1 Viewer)

vid

Registered User.
Local time
Today, 00:31
Joined
Feb 4, 2010
Messages
62
Hi!

I have a database which already has a lot of data. However my I need to add in a record for Warranty ID (which is an autonumber field) = 29. How can i do this?
Please help.. I don't want to delete all data and key it in all over again!!!
 

John Big Booty

AWF VIP
Local time
Today, 17:31
Joined
Aug 29, 2005
Messages
8,262
Why do you need to add a value to an AutoNumber field? The whole point of an AutoNumber field is that it Automatically generates a unique (not necessarily consecutive and not necessarily positive, just unique) numeric reference number.
 

vid

Registered User.
Local time
Today, 00:31
Joined
Feb 4, 2010
Messages
62
yeah i know, but the problem is that i need to add the old data into this database too. For those some specific value already exists.. So its a pain adding those records if i'm gonna have to empty everything and add again...
 

John Big Booty

AWF VIP
Local time
Today, 17:31
Joined
Aug 29, 2005
Messages
8,262
Why not simply import your master data from the old DB. Let you current DB assign an AutoNumber to it, then update your Foreign Keys (FK) in the child data then import that?

Of course you are going to need some temporary fields to allow you maintain your old referential links.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:31
Joined
Aug 30, 2003
Messages
36,133
You should be able to add a specific value as part of an append query:

INSERT INTO TableName(IDField, OtherField)
VALUES(29, Whatever)
 

vid

Registered User.
Local time
Today, 00:31
Joined
Feb 4, 2010
Messages
62
Ohhh!! Thank you sooo much... :)
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:31
Joined
Aug 30, 2003
Messages
36,133
No problem. As John said, it's normally not needed or even a good idea, but there are those times when we need to do it.
 

vbaInet

AWF VIP
Local time
Today, 08:31
Joined
Jan 22, 2010
Messages
26,374
You should be able to add a specific value as part of an append query:

INSERT INTO TableName(IDField, OtherField)
VALUES(29, Whatever)
Paul I forgot about that. I was importing some text files with autonumber fields recently and had to implement the Dictionary object. It was pretty quick as well.
 

Users who are viewing this thread

Top Bottom