DAO and Indexing

T

taccea

Thanks to all trying to help.
It is easier for me to send a new message to all groups that responded.

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
*******************************
 
D

Dirk Goldgar

taccea said:
Thanks to all trying to help.
It is easier for me to send a new message to all groups that
responded.

Please be aware that posting a new message this way, along with having
multiple discussion threads on the same question open at once, actually
makes it harder for the people who have been trying to help you. Most
newsgroup regulars use newsreader programs that highlight discussion
threads that they are involved in. That way they can see if there are
followup questions, or a posted acknowledgement that a particular
question has reached a satisfactory resolution. Starting multiple
discussion threads over the same issue, like posting the same question
independently to multiple newsgroups, forces people to hunt through the
newsgroups for relevant information, and thus puts an unfair burden on
the very people who are trying to solve your problem.

You may want to read the netiquette FAQ at
http://www.mvps.org/access/netiquette.htm .
 
A

Allen Browne

I did not read your earlier thread, so I don't know what error message you
are receiving. Is it possible that one of the tables already has an index
named "ixBonus_idS_row_id", and so you cnanot create another? It may be a
hidden index. This code should expose it:

Function ShowRel()
Dim db As DAO.Database
Dim rel As DAO.Relation
Dim fld As DAO.Field

Set db = CurrentDb()
For Each rel In db.Relations
Debug.Print rel.Name, rel.Table, rel.ForeignTable
For Each fld In rel.Fields
Debug.Print , fld.Name, fld.ForeignName
Next
Next

Set fld = Nothing
Set rel = Nothing
Set db = Nothing
End Function


If that's not the case, then Access is probably confused about the names of
the objects. This can happen if you have not disabled Name AutoCorrect
under:
Tools | Options General
Try unchecking the Name AutoCorrect boxes there, and then compacting the
database.

More info on the Name AutoCorrupt problems:
http://members.iinet.net.au/~allenbrowne/bug-03.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top