I just have a table with many fileds.
I nedd to add a filed named AKEY a primary key with autocounter into the top of fields list.
All with code vb and jet conn or adox code. Possible?
INSERT primary key with autocounter
-
- PlatinumLounger
- Posts: 4373
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: INSERT primary key with autocounter
Create an SQL string like this:
Dim strSQL As String
strSQL = "ALTER TABLE MyTable ADD COLUMN AKEY COUNTER CONSTRAINT PrimaryKey PRIMARY KEY"
where MyTable is the name of the table.
You can use the Execute method of your ADODB Connection object to run the SQL.
Dim strSQL As String
strSQL = "ALTER TABLE MyTable ADD COLUMN AKEY COUNTER CONSTRAINT PrimaryKey PRIMARY KEY"
where MyTable is the name of the table.
You can use the Execute method of your ADODB Connection object to run the SQL.
Best wishes,
Hans
Hans