Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with Seek() function
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00814877
Message ID:
00814890
Views:
9
>Don't rely on default value but check what setting you actualy have
? SET("NEAR")
>
>>I have a table indexed on an integer field in the "Key" tag with these values:
>>702065
>>702066
>>702067
>>702068
>>702069
>>etc....
>>
>>The record with the value 702066 in deleted and i Set Deleted On in my program.
>>If i write (also in Command Window)
>>
>>Messagebox(Seek(702066,"MyTable","Key"))
>>
>>It returns the .F. value but the record pointer is not positioned to the end of MyTable (Eof), but on the record after that deleted with the value i searched (702067).
>>
>>In the fox Guide i read:
>>"If a match is found, SEEK( ) returns true (.T.), and the record pointer moves to the matching record. If no match is found, SEEK( ) returns false (.F.) and the record pointer moves to the end of the file."
>>
>>I have no settings on SET NEAR and the default value must be "OFF"
>>
>>Where is the error.

With the debug the Sys(2001,"NEAR") return OFF
In my program i have:

If Seek( nKey, "MyTable1", "KEY") && This Seek is passed even if the value is in deleted record
If Seek(nKey, "MyTable2", "KEY") && the same seek on another table with same tags isn't passed
EndIf
Endif

I have seen that in Command Window using set near On or Off the same seek is correct and the record pointer is moved in eof
The problem is that if the NEAR is not set correctly why for the first seek the record pointer is moved on the nearest value (like if NEAR = OFF) and for the second seek the record pointer is moved in eof ? If the problem is NEAR the program must work in the same way on my two seek operation.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform