I am trying to add a two-field primary key to a table in code (i'm trying to use a Data Definition query, but could probably also do it through VBA, though that is just a little extra work).
To begin, I am trying just to add a one-field primary key
ALTER TABLE <table>
ALTER COLUMN <onefield> TEXT
CONSTRAINT PK_<table> PRIMARY KEY
When it runs I get this error:
File Sharing Lock Count Exceeded.
I know that I could edit the registry to allow more locks, but why can I add a primary key through the Access UI without problem but not with code? Is there a problem with my ALTER TABLE statement? And how would I add a second field.