J
Jonathan Wood
Greetings,
I use the following code to create a relationship between table A and table
B:
Set rel = db.CreateRelation("A_B")
rel.Table = "A"
rel.ForeignTable = "B"
Set fld = rel.CreateField("AID")
fld.ForeignName = "BID"
rel.Fields.Append fld
db.Relations.Append rel
This code works as expected, but a few lines later I call DLookup() on table
'B' and I get the following error:
"Run-time error '3008': The table 'B' is already opened exclusively by
another user, or it is already open through the user interface and cannot be
manipulated programmatically."
If I comment out the code above, the error goes away. I tried setting rel
and fld to Nothing, and I tried calling db.Tabledefs.Refresh but this
appears to have no effect.
Does anyone understand why this lock is occurring or what I might to about
it?
Thanks.
Jon
I use the following code to create a relationship between table A and table
B:
Set rel = db.CreateRelation("A_B")
rel.Table = "A"
rel.ForeignTable = "B"
Set fld = rel.CreateField("AID")
fld.ForeignName = "BID"
rel.Fields.Append fld
db.Relations.Append rel
This code works as expected, but a few lines later I call DLookup() on table
'B' and I get the following error:
"Run-time error '3008': The table 'B' is already opened exclusively by
another user, or it is already open through the user interface and cannot be
manipulated programmatically."
If I comment out the code above, the error goes away. I tried setting rel
and fld to Nothing, and I tried calling db.Tabledefs.Refresh but this
appears to have no effect.
Does anyone understand why this lock is occurring or what I might to about
it?
Thanks.
Jon