D
Dan
I'm using the following code in an attempt to modify the Primary key in a
linked table upon database startup. When the code reaches the
"idxCurr.Primary = False" statement I receive the following error: "Cannot
set this property once the object is part of a collection." Can anyone
explain what I'm running into and a possible solution? Thanks.
CODE---------
'Delete existing relationships between master product tables
dblink.Relations.Delete "MasterProdListMasterProdAppList"
dblink.Relations.Delete "MasterProdListMasterProdLabelGrp"
dblink.Relations.Delete "MasterProdListMasterProdLaundry"
dblink.Relations.Delete "MasterProdListMasterProdSanType"
'Modify key field of master product tables.
Set tdf = dblink.TableDefs("MasterProdList")
For Each idxCurr In tdf.Indexes
idxCurr.Primary = False
Next idxCurr
Set idxCurr = tdf.CreateIndex("ProdGrp")
With idxCurr
.Fields.Append .CreateField("ProdGrp")
End With
idxCurr.Primary = True
tdf.Indexes.Append idxCurr
Set idxCurr = Nothing
Set tdf = Nothing
linked table upon database startup. When the code reaches the
"idxCurr.Primary = False" statement I receive the following error: "Cannot
set this property once the object is part of a collection." Can anyone
explain what I'm running into and a possible solution? Thanks.
CODE---------
'Delete existing relationships between master product tables
dblink.Relations.Delete "MasterProdListMasterProdAppList"
dblink.Relations.Delete "MasterProdListMasterProdLabelGrp"
dblink.Relations.Delete "MasterProdListMasterProdLaundry"
dblink.Relations.Delete "MasterProdListMasterProdSanType"
'Modify key field of master product tables.
Set tdf = dblink.TableDefs("MasterProdList")
For Each idxCurr In tdf.Indexes
idxCurr.Primary = False
Next idxCurr
Set idxCurr = tdf.CreateIndex("ProdGrp")
With idxCurr
.Fields.Append .CreateField("ProdGrp")
End With
idxCurr.Primary = True
tdf.Indexes.Append idxCurr
Set idxCurr = Nothing
Set tdf = Nothing