Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seek method, error 3800 (... is not an index) although the index exist 1

Status
Not open for further replies.

Recparc

Programmer
Dec 2, 2000
2
DE
Dear all,

if I use the seek method I got error message with error code 3800 - IndexName is not an index in this table.

This message appears although the index exist in the table. If I delete the index in the table, save the table and define the index new than the seek method works.

However, that is no solution since I have to create several tables via VBA. That means I cannot always delete and set the index new.

Is that just a bug or is my code wrong?

I use seek as follows:

RecordsetName.Index = "Nr" 'name of the field in the table
RecordsetName.Seek "=", SeekString

(DAO 3.6)

Thank you in advance

Rec
 
Access assigns default index names when you create an index. In a table design grid, when you set the primary key, the default name of its index is PrimaryKey. For indexes that you create by setting the Indexed property of a field in the design grid, the default index name is the field name. Indexes created automatically by the AutoIndex feature are usually named after the field as well. For indexes created in the Index window, you must specify the name in the grid. For indexes you create in DAO, you specify the name with a CreateIndex method parameter.

So the name of an index depends on how you create it, and it isn't always the same as the field name. Are you perhaps assuming incorrectly that all indexes are named after the field? How are you creating the index you have the problem with?

You can always determine the name of each index by opening the table in design view, and then viewing the Index window. Rick Sprague
 
Thank you Rick. That was indeed the solution. I assumed that the name of an index is the same as the name of a field. That is wrong, e.g. you can create an index for serveral fields. However, the documentation of that isssue is not that good...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top