• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:

Access 2000 - Autonumber for table from Make table query

Dear Experts,

I have a make table query from where I would like create also a Primary key so an autonumber field for the created table by it.

Could you please advise how to do that

thanks,
0
csehz
Asked:
csehz
3 Solutions
 
Rey Obrero (Capricorn1)Commented:
the easiest way to do this is to open the table in design view, add an autonumber field and make it a primary key.

you can also do this using

alter table [NameOfTable] add column id counter
0
 
peter57rCommented:
cap1 has given you the solution.  The point is, you cannot add the autonumber field via the make-table query.
0
 
Om PrakashCommented:
You can create a table with all the fields, keys & properties you want, and then use an append query, instead of using a create table query

You can use use TableDefs or DDL statements

To add auto number field, following is the query:
alter table table_name add COLUMN AutoField COUNTER EDIT Additional note

And to make this column as primary key, you can use the following query:
alter table table_name ADD PRIMARY KEY (AutoField)
0
 
csehzAuthor Commented:
Thanks very much, I have learnt from all of three answers, can I give the points as split?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now