Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Circumvent RECNO(0
Message
From
13/08/1998 16:02:32
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
12/08/1998 15:17:40
Zaraq Bari
Bari Studios Limited
Lahore, Pakistan
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00126162
Message ID:
00126696
Views:
21
>This is an extract from the VFP Help:
>"RECNO( ) issued without the optional arguments nWorkArea or cTableAlias returns the current record number for the table in the currently selected work area.
>If you have issued SEEK unsuccessfully in an indexed table, you can specify 0 for nWorkArea to use “soft seek” logic to return the record number of the closest matching record. RECNO(0) returns 0 if a close match cannot be found. Visual FoxPro generates an error message if you issue GO RECNO(0) when a close match isn’t found."
>
>My question is how do I bypass GO RECNO(0) without generating an error.If I try to LOCATE FOR records that are not in the table , the error message is generated.
>Any Suggestions?

Recno(0) is set only after a SEEK, and I've never heard of it being set after a LOCATE.

Anyway, the usual sequence goes like this:

if seek(lcKey)
* then it's OK
else
lnRecno0=recno(0)
do case
case lnRecno(0)>recc()
* lcKey is greater than any of our keys
go bott
case lnRecno()=0
* lcKey is less than any of our keys
go top
other
* lcKey doesn't exist, but it's between two existing keys, so let's go to the next greater one:
go lnRecno
endcase
endif

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform