Cetin,
Your example works exactly as I would have expected. My application whould be performing in the same manner. When I set key to 6 and seek as in my example I should find the record that is there with that key. I am not sure why it would fail. Doesn't seem like it should. I am going to go back and validate the databse, reindex and see it the results change. As I do this rather often I don't think they will but it is worth a shot.
Have you or anyone selse seen seek( x, file, tag) fail while set key is in place before?
>"Set key" is a kind of filter on index. It limits access to part of index. If your seek() falls in that range of "set key" then seek() returns .t. (you limit seek to a range).
>ie: home()+"samples\data\customer" has country and contact indexes.
>
set order to tag country
>set key to "GERMANY"
>?seek("Janine Labrune","customer","contacts")
>set key to
>?seek("Janine Labrune","customer","contacts")
If applicable set key seems much faster than filter.
>Cetin
>
>>>Is show fk a filtered or unique index?
>>
>>No. :)
>>
>>
>>Showfk is a foreign key to the show table and is a regular VFP index, no filter, non-unique key.
>>
>>In my tables there are multiple records for each show. My current application uses SET FILTER to limit records to the currently selected show. I saw another message about SET KEY and thought that maybe this would be better for what I was doing. I played around with SET KEY and found the things that I outlined in my message.
>>
>>I guess I thought that I could use SET KEY as a replacement for SET FILTER. From what I discovered my assumption must have been wrong or I don't understand the proper use of SET KEY.
>>
>>
>>>>I am playing around with set key vs set filter and ran across this. I set key then seek on a different tag and it fails. I set filter and seek and it works.
>>>>
>>>>*Sample code
>>>>use exhiinfo
>>>>set order to showfk
>>>>set key to 6
>>>>?seek(3, 'exhiinfo', "Accnum") && fails
>>>>
>>>>set order to accnum
>>>>* this will locate a recordd that is outside the set key range
>>>>?seek(3, 'exhiinfo', "Accnum")
>>>>
>>>>set key to
>>>>
>>>>set filter to showfk = 6
>>>>locate
>>>>?seek(3, 'exhiinfo', "Accnum") && this works
>>>>
>>>>Anybody seen this before. Am I using set key wrong?