Good Morning to All,
I hope someone can give me a hand here!
I am trying to do an “automatic” Version Update on my backend DB. I am using the following code to create a new Table. My only problem is that I can’t seem to set the primary key. It does create a unique index for “RID” but doesn’t have the little key symbol next to it! Why not?
And the next problem is how to create a “double key” eg. I have a table where the key should be a combination of Staff_ID and Form_ID
Set td = db.CreateTableDef("Reihentbl")
Set fld = td.CreateField("RID", dbLong)
fld.Required = True
fld.Attributes = dbAutoIncrField
td.Fields.Append fld
Set idx = td.CreateIndex("RID") 'Primary key
idx.Unique = True
Set fld = idx.CreateField("RID", dbLong)
idx.Fields.Append fld
td.Indexes.Append idx
Set fld = td.CreateField("Reihe", dbText, 5)
fld.Required = False
fld.AllowZeroLength = True
td.Fields.Append fld
Set fld = td.CreateField("RBezeichnung", dbText, 100)
fld.Required = False
fld.AllowZeroLength = True
td.Fields.Append fld
Set fld = td.CreateField("BFID", dbLong)
td.Fields.Append fld
db.TableDefs.Append td
I hope someone can give me a hand here!
I am trying to do an “automatic” Version Update on my backend DB. I am using the following code to create a new Table. My only problem is that I can’t seem to set the primary key. It does create a unique index for “RID” but doesn’t have the little key symbol next to it! Why not?
And the next problem is how to create a “double key” eg. I have a table where the key should be a combination of Staff_ID and Form_ID
Set td = db.CreateTableDef("Reihentbl")
Set fld = td.CreateField("RID", dbLong)
fld.Required = True
fld.Attributes = dbAutoIncrField
td.Fields.Append fld
Set idx = td.CreateIndex("RID") 'Primary key
idx.Unique = True
Set fld = idx.CreateField("RID", dbLong)
idx.Fields.Append fld
td.Indexes.Append idx
Set fld = td.CreateField("Reihe", dbText, 5)
fld.Required = False
fld.AllowZeroLength = True
td.Fields.Append fld
Set fld = td.CreateField("RBezeichnung", dbText, 100)
fld.Required = False
fld.AllowZeroLength = True
td.Fields.Append fld
Set fld = td.CreateField("BFID", dbLong)
td.Fields.Append fld
db.TableDefs.Append td