Dec 6, 2005 #1 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
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
Dec 6, 2005 #2 PHV MIS Nov 8, 2002 53,708 FR 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 Upvote 0 Downvote
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
Dec 7, 2005 Thread starter #3 Ielamrani MIS Jul 7, 2005 183 US As usual you're amazing. Thanks a ton. Ismail Upvote 0 Downvote