Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to seek without moving the record pointer
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00581456
Message ID:
00581465
Views:
15
You'll have to write your own. Here's a one I wrote a while ago
*            
*            
*  Purpose  Check for the key in a file
*            
*  Param's  
*            1 [C,R] - Key to check for
*            2 [C,O] - Alias to check in
*            3 [C,O] - Tag name
*            4 [L,O] - Keep record pointer in the file, if .T.
*            5 [L,O] - Look for exact match, if .T.
*            
*   Return  .T. if record is found

PARAMETER pcKey, pcAlias, pcTag, lSavePos, lExact

PRIVATE cOldArea, cOldTag, cOldExact, lFound, nOldRecno

cOldArea  = SELECT()
cOldExact = SET("EXACT")

IF NOT EMPTY(pcAlias)
	SELECT (pcAlias)
ENDIF	

cOldTag = TAG()

nOldRecno = RECNO()

IF NOT EMPTY(pcTag)
	SET ORDER TO (pcTag)
ENDIF	

IF lExact
	SET EXACT ON
ELSE
	SET EXACT OFF
ENDIF

lFound = SEEK(pcKey)

* Restore settings

DO CASE
CASE NOT lSavePos
	* Do not restore record pointer
CASE RECCOUNT() = 0
	* No records in table
CASE BETWEEN(nOldRecno, 1, RECCOUNT())
	GOTO (nOldRecno)
CASE nOldRecno > RECCOUNT()
	GOTO BOTTOM
	SKIP
ENDCASE	

SET ORDER TO (cOldTag)
SELECT (cOldArea)
SET EXACT &cOldExact

RETURN lFound
>Using vfp5...
>
>Is there a function to search a table for a certain record without
>moving the record pointer. At first I thought keymatch but now
>it appears it moves the pointer, indexseek doesn't appear to
>be available till vfp6. I know... upgrade. It's the first thing
>I will do when I'm allow to spend again. I'm not looking forward
>to having to buy vfp7 and VS separatly though. Twice the dough.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform