Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Seek
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: Seek
Miscellaneous
Thread ID:
00895885
Message ID:
00901138
Views:
21
>You can issue this
>Sample:
>
>
Set exact off
>Select Customers
>Set Order To TAG "Your Index tag"
>Go top
>Seek(cSearchstr)
>Set exact on


Jojo:

I see a few problems with your example, if you permit me to comment.

As stated in this thread, SET EXACT is scoped to the datasession. It is not necessary to change it prior to the SEEK. Also you are forcing it OFF before the SEEK and ON immediately after the SEEK. In proper (best practices) programming, the method should not assume that it has to go back top EXACT ON after forcing it off, buit it should then go back to whatever it was before. That is, you should save the previous state with SET("EXACT") and return it. Any method should act as a black box, leaving any settings the way it found them.

You do not need to GO TOP before a SEEK() as this function starts at the top anyway. GO TOP can be slow, especially in a filtered table.

SEEK() returns a value that you are not considering. You should always check for it to see if SEEK() failed
If Seek(cSearchstr)
   * found
Else
   * did not find
Endif
HTH


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform