changed autonumber to number...

yepwingtim

Registered User.
Local time
Today, 11:10
Joined
Jun 6, 2008
Messages
126
how can i change the number data type as autonumber?
________
Regi-Stick
 
Last edited:
A number can't be changed to autonumber. You would have to add an autonumber field to the table and then probably do an update on any related tables to change the number value to the autonumber value.
 
hi bob thanks for the quick reply,

I tried updating or appending, but it doesn't let me update or append any records to a autonumber field
________
Ford Escort Rs 1700T Picture
 
Last edited:
hi bob thanks for the quick reply,

I tried updating or appending, but it doesn't let me update or append any records to a autonumber field
You didn't understand. You don't modify the autonumber field. You need to update the FOREIGN KEYS to the NEW autonumber field. You would have your number field still in your table so you can identify which records link to each other and then you have to run an update query to modify those foreign key field to the NEW AUTONUMBER, you don't change the autonumber.
 
i m unable update the number field to the new autonumber field...
maybe im confused sorry~
________
Cr480
 
Last edited:
i m unable update the number field to the new autonumber field...
maybe im confused sorry~

Okay,

Table1 which has number field:
IDNum - Long Integer (PK)


Table 2 which has number field:
T2ID - Autonumber (PK)
IDNum - Long Integer (FK)

Now you want to change Table 1 to autonumber you would then add the new autonumber column, we'll call it IDANum:

Table1 which has number field:
IDANum - Autonumber
IDNum - Long Integer (PK)


So then we now have an autonumber field and the other field in Table 1.


Now, we need to update Table 2's IDNum, so we use an update query to change Table 2's IDNum to the new Autonumber which matches the IDNum in Table 1:


UPDATE Table1 INNER JOIN Table2 ON Table1.IDNum = Table2.IDNum SET Table2.IDNum = [Table1].[IDANum];

And then once Table2 (and any other table that is based on the IDNum of Table 1 is set) you can delete IDNum from Table1, leaving IDANum when you can then rename back to IDNum.
 

Users who are viewing this thread

Back
Top Bottom