Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
New GOTO trick?
Message
From
16/03/2002 02:54:46
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00631774
Message ID:
00633707
Views:
26
>Hi Dragan,
>
>>Actually, you have to check for recno()=0 on empty tables
>
>Are you sure? So far, that situation has always returned 1 for me.

Not sure - and now that you mention that, it's related to some spaghetti code I had to fix, where the variable to hold the record was initialized to zero, and didn't really get a value if no records. That's the reason I remember I had to check for between(nRecno, 1, recc()), just in case.

>>but that's all - no error.
>
>Not quite. LOCATE RECORD accepts any value that RECNO() returns on the current table. If you pass a record number that doesn't exist either as a regular record or as a phantom record, it still errors. However, almost everytime I have to go to a certain record number, it is because I want to restore the record position that the cursor had when FoxPro entered a procedure or method. In this case, I can ensure that the record number is still valid providing that I haven't requeried the cursor. What I can't ensure is that I'm not on EOF.

Of course - but then you were there when you assigned the recno() to the variable, so even the EOF condition is restored, which is actually cool. I'm debugging something long at the moment, so I can't test this myself at the moment, but as long as it's VFP cursors-tables-views, this is a good tip to remember.

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