J
john
Here is my code, Table is tblCurrentV and Field name is ID, that I need to
make as Primary after it is created by Make-Table Query. I don't get an
error, but when I run the code , but when I look at the Table after it runs,
it is still not set to Primary Key. I need it so another query that is
related will be updateable.
Dim db As Database
Dim idx As index
Dim tdf As TableDef
Set db = CurrentDb
Set tdf = db.TableDefs("tblCurrentV")
With tdf
Set idx = .CreateIndex("ID")
With idx
.Primary = True
End With
End With
Set db = Nothing
Set tdf = Nothing
Set idx = Nothing
***********
I've also tied this code, get an error saying it cannot find the table?
db.Execute "CREATEINDEX PrimaryKey ON tblCurrentV (ID);"
Thanks John
make as Primary after it is created by Make-Table Query. I don't get an
error, but when I run the code , but when I look at the Table after it runs,
it is still not set to Primary Key. I need it so another query that is
related will be updateable.
Dim db As Database
Dim idx As index
Dim tdf As TableDef
Set db = CurrentDb
Set tdf = db.TableDefs("tblCurrentV")
With tdf
Set idx = .CreateIndex("ID")
With idx
.Primary = True
End With
End With
Set db = Nothing
Set tdf = Nothing
Set idx = Nothing
***********
I've also tied this code, get an error saying it cannot find the table?
db.Execute "CREATEINDEX PrimaryKey ON tblCurrentV (ID);"
Thanks John