Primary Key

  • Thread starter Thread starter Smudger
  • Start date Start date
S

Smudger

Help me please.

I am using Access 2000 to run a make table query. IS
there any way to create a primary key automatically rather
than manually going into the table and creating one?

Thanks in advance!!!
 
Hi,


Once the table is created, you can run:


CurrentDb.Execute "ALTER TABLE tableNameHere ADD CONSTRAINT
aNameYouLikeForTheConstraint PRIMARY KEY ( fieldNameHere ) " , dbFailOnError



In this SQL statement, all caps words are key words to be typed as they
appear, the other words have to be customized or selected as you please. (
CurrentDb.execute, and the second argument, dbFailOnError, are not part of
the SQL statement, and should also be type as it is).



Hoping it may help
Vanderghast, Access MVP
 
Back
Top