Setting Primary Keys in a Table

Carly

Registered User.
Local time
Today, 16:54
Joined
Apr 16, 2003
Messages
86
I have a query which updates a table but when this happens the primary keys are removed. Is there any way in which i can reset the primary keys.

I have tried the following code:
Code:
 Docmd.OpenTable "DML Initial Stock",acDesign
Docmd.RunCommand.acCmdPrimaryKey

But this only sets the key on the 1st column. I need to set the key on the 1st 2 columns.

Is there a way this can be done?
 
No update query would remove the primary key. You must be running a make-table query which is recreating the table. You can use DDL to add the pk. To find help, Open help from the database window and go to the table of contents tab. Toward the bottom of the list you'll see Microsoft Jet Language reference. Open it up and find the entries for Alter Table and Constraint.
 

Users who are viewing this thread

Back
Top Bottom