
Using SEEK on DBF files and indexes
Hello out there,
I have got a question about handling dBASE indexes in VB5.
The problem:
I am opening a dBASE III table directly using the OpenDatabase method.
The dbf file contains several indexes (not created by VB5) of which index 2
consists of 2 attributes. Using the seek method never gives me a proper
result.
Going into this problem I found something strange.
When I look into the index file using notepad I see the following first
line:
?^ _ _ _ STR(SOFINR,9) + STR(ANR,10)
The two attributes SOFINR and ANR are in the correct order and with the
correct length.
When I use the tabledefs and indexes in VB to determine what indexes are
present and which attributes the indexes consists of I get the following:
td.Indexes(1).Fields = "+ANR;+SOFINR"
The attributes are not in the proper expected order.
Could this be the reason I do not find any data?
Using Dbase there are no problems.
As a test i created an extra index on the file using the following VB
statements.
Set id = td.CreateIndex("test#003")
id.Fields.Append id.CreateField("Sofinr")
id.Fields.Append id.CreateField("Anr")
td.Indexes.Append id
td.Indexes.Refresh
Looking into the created index file test.003 shows the following first line:
__ X^ C _ _ _ _ STR(SOFINR,9,0)+STR(ANR,10,0)
Using VB to show me the attributes of the index gives me the following info:
td.Indexes(2).Fields = "+SOFINR;+ANR"
This is OK.
Using this index in VB gives me proper results.
Is this a VB bug?
Any ideas?
Thanks in advance
Robert-Jan van Diest