perhaps just posted, sorry create id key with autonumber with ado
-
- PlatinumLounger
- Posts: 4351
- Joined: 26 Apr 2010, 17:36
perhaps just posted, sorry create id key with autonumber with ado
how create idx field in mytable with autonumber with ado?
-
- Administrator
- Posts: 78412
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: perhaps just posted, sorry create id key with autonumber with ado
To add an AutoNumber field named idx in MyTable, open a connection CONN on the database, and execute the following SQL string:
To create a primary index on that field, execute
Code: Select all
CONN.Execute CommandText:="ALTER TABLE MyTable ADD COLUMN idx COUNTER", Options:=adExecuteNoRecords
Code: Select all
CONN.Execute CommandText:="CREATE INDEX PrimaryKey ON MyTable (idx) WITH PRIMARY", Options:=adExecuteNoRecords
Best wishes,
Hans
Hans