Problem with CREATE TABLE
Posted on 2000-01-14
In a form I create a table. The code lines follow:
dbs.Execute "CREATE TABLE " & TableName & " (TCName TEXT CONSTRAINT c PRIMARY KEY,vendor TEXT);"
The table is created correctly and I fill it with data. Then I try to access a record with the following code:
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset(TableName)
rst.Index = "PrimaryKey"
I get an error: "Primary Key isn't an index in this table.
When I open the table and look at the definition for TCName it IS a primary key. If I turn the 'Key' off and then back on and rerun the form, everything is ok.
What is going on?