Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
New GOTO trick?
Message
From
12/03/2002 16:39:45
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
New GOTO trick?
Miscellaneous
Thread ID:
00631774
Message ID:
00631774
Views:
60
Using a framework that shall remain nameless(and blameless), I had a GOTO tiRecNo return an error. It turned out to be my own stupid fault, trying the GOTO on an empty table. I didn't catch it because RECNO() on the table returned 1, as the helpfile states it should. That led me to this little gem:

IF RECNO() <= RECCOUNT()
GOTO tiRecNo
ELSE
*Error handling time.
ENDIF

This will return .F. for BOF(1>0), EOF(10>9) and empty table(1>0) conditions, essentially checking for three possible error conditions at the same time.

Don't know if this is a known trick or not, but here it is, and I hope someone finds it useful.
Next
Reply
Map
View

Click here to load this message in the networking platform