access vba alter table

Soma_rich

Registered User.
Local time
Today, 10:44
Joined
May 2, 2007
Messages
58
Bit of a two sided question this,
1) How can I specify where in a table I want to insert a column, I would like the ID column at the begining, but this code always appends to the end:
Code:
DoCmd.RunSQL "ALTER TABLE OS_MAINb ADD COLUMN [ID2] BYTE"

2) Now I am sure this is a simple one, how do you define the column as an Autonumber datatype?

Thanks in advance
 
Bit of a two sided question this,
1) How can I specify where in a table I want to insert a column, I would like the ID column at the begining, but this code always appends to the end:
Code:
DoCmd.RunSQL "ALTER TABLE OS_MAINb ADD COLUMN [ID2] BYTE"

2) Now I am sure this is a simple one, how do you define the column as an Autonumber datatype?

Thanks in advance

From what i've read columns in tables do not actaully have any order, they may appear to but thisis due to the tool you are using. I guess the software (Access) is simply doing what its told and altering the table.

The question i guess this raises is why does anyone need the ID (autonumber) column at the left most position if not only for clarity, maybe set as a PK.

My next is, why use code to alter a table when you could simply open the table and add the column?
 

Users who are viewing this thread

Back
Top Bottom