C
CA_IT
I have a piece of code that first tests for the existance of a table, then
drops it, and recreates it. It has been working fine for about 6 months.
Suddenly, I am getting a 'table already exists' error. When looping through
the code, I find it is never found when looping through the tabledefs.
Further investigation revealed that I have a table that is listed in the
mSysObjects table, but not the database window. Below is the relevent code
snippets
'test and drop if present
For Each tdfOld In db.TableDefs
If tdfOld.Name = "temptblCommitteeLabels_New" Then
db.TableDefs.Delete "temptblCommitteeLabels_New"
'create new table
Set tdfNew = db.CreateTableDef("temptblCommitteeLabels")
With tdfNew
.Fields.Append .CreateField("strCompany", dbText)
.Fields.Append .CreateField("firstname", dbText)
.Fields.Append .CreateField("lastname", dbText)
.Fields.Append .CreateField("strbusinessaddress", dbText)
.Fields.Append .CreateField("strcity", dbText)
.Fields.Append .CreateField("strstate", dbText)
.Fields.Append .CreateField("strzip", dbText)
.Fields.Append .CreateField("TermBegan", dbText)
.Fields.Append .CreateField("TermEnded", dbText)
.Fields.Append .CreateField("TermsServed", dbText)
.Fields.Append .CreateField("CurrentStatus", dbText)
.Fields.Append .CreateField("CommitteeName", dbText)
.Fields.Append .CreateField("PositionName", dbText)
.Fields.Append .CreateField("sortpos", dbText)
db.TableDefs.Append tdfNew
As I stated, the code has been working fine for several months. So far I
have done the compact and repair routine about 10 times, and the importing
objects into a new database twice. It should be noted, when doing the import
objects, that this ghost table is not in the list, but, does import to the
new database.
I have done a work around of using a new table name, however, I would like
to get this ghost out of my DB!!
Thanks in advance!
drops it, and recreates it. It has been working fine for about 6 months.
Suddenly, I am getting a 'table already exists' error. When looping through
the code, I find it is never found when looping through the tabledefs.
Further investigation revealed that I have a table that is listed in the
mSysObjects table, but not the database window. Below is the relevent code
snippets
'test and drop if present
For Each tdfOld In db.TableDefs
If tdfOld.Name = "temptblCommitteeLabels_New" Then
db.TableDefs.Delete "temptblCommitteeLabels_New"
'create new table
Set tdfNew = db.CreateTableDef("temptblCommitteeLabels")
With tdfNew
.Fields.Append .CreateField("strCompany", dbText)
.Fields.Append .CreateField("firstname", dbText)
.Fields.Append .CreateField("lastname", dbText)
.Fields.Append .CreateField("strbusinessaddress", dbText)
.Fields.Append .CreateField("strcity", dbText)
.Fields.Append .CreateField("strstate", dbText)
.Fields.Append .CreateField("strzip", dbText)
.Fields.Append .CreateField("TermBegan", dbText)
.Fields.Append .CreateField("TermEnded", dbText)
.Fields.Append .CreateField("TermsServed", dbText)
.Fields.Append .CreateField("CurrentStatus", dbText)
.Fields.Append .CreateField("CommitteeName", dbText)
.Fields.Append .CreateField("PositionName", dbText)
.Fields.Append .CreateField("sortpos", dbText)
db.TableDefs.Append tdfNew
As I stated, the code has been working fine for several months. So far I
have done the compact and repair routine about 10 times, and the importing
objects into a new database twice. It should be noted, when doing the import
objects, that this ghost table is not in the list, but, does import to the
new database.
I have done a work around of using a new table name, however, I would like
to get this ghost out of my DB!!
Thanks in advance!