taccea said:
Thanks Dirk for correcting me about not starting a new thread,
Here is the text of the new one I had written so everyone can check
for follow ups..
I was calling DAO, ADO.
Here is the code that works FINE as long as I make a copy of the
table in Access2000 :
Please notice that the only difference is that "ghtCHeckDetail"
is the table brought in via DoCmd.TransferDatabase, acImport
and "ghtCHeckDetail2" is a copy.
The very same code below does NOT run on "ghtCHeckDetail"
Thanks
Taccea
****************************************
DoCmd.CopyObject , "ghtCheckDetail2", acTable, "ghtCHeckDetail"
Dim dbsPBFirst As Database
Set dbsPBFirst = CurrentDb
Dim tdfGHTcheckDetail As TableDef
Set tdfGHTcheckDetail = dbsPBFirst!ghtCheckDetail2
Dim idxBonusID As Index
With tdfGHTcheckDetail
Set idxBonusID = .CreateIndex("ixBonus_idS_row_id")
With idxBonusID
.Fields.Append .CreateField("bonus_id")
.Fields.Append .CreateField("s_row_id")
End With
.Indexes.Append idxBonusID
.Indexes.Refresh
End With
*******************************
I haven't been following this from the beginning, so let me ask a few
questions:
1. The table "ghtCHeckDetail" is one that you have imported from another
database using TransferDatabase? You actually imported it; you didn't
link it?
2. What error message and number do you get when you run the code on the
original, imported table?
4. What line of the code raises the error?
5. Does it make any difference if you close the database after importing
the table, then reopen it and try to run the code?
6. Does the imported table already have indexes? What are they named?
7. Is the database from which you copied the table an Access MDB file of
the same version as the one you are copying into?
8. Is the imported table empty, or does it contain records?
9. When you copy the table and build the index on the copy, is that copy
empty, or does it contain the same records as the original?