Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Primary Key!

Status
Not open for further replies.

Ielamrani

MIS
Jul 7, 2005
183
US
How can I add a primary key (number)to an existing empty field?

This is the table I have:

Id Name Title

John Director
Paul Analyst
Puala Programmer

I would like to add in the ID field 1 to John, 2 to Paul and 3 to Puala ect..

Thanks in advance
 
DoCmd.RunSQL "ALTER TABLE myTable DROP COLUMN Id"
DoCmd.RunSQL "ALTER TABLE myTable ADD COLUMN Id COUNTER(1,1) CONSTRAINT PrimaryKey PRIMARY KEY"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top