Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
'skip 1' always gives blank record at eof
Message
From
16/08/1999 16:00:34
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00254129
Message ID:
00254243
Views:
21
>I've always had this problem but never knew how to solve
>it. I hope there's an easy fix. I have a button 'Next'
>which skips through records on a form. Here's the
>code that it executes.
>
>if not eof() then
> skip 1
>endif
>
>Problem is that always after the last record a blank
>record appears. I really don't think it's a record
>but all fields go blank presumably because it skips to
>the end of the last record and there is nothing to
>display. How can I fix this behavior?

A better solution may be to disable the next and last buttons when on the last record. You would run this code each time you move the record pointer.

lnRetRec = RECNO()
GO BOTTOM
lnLastRec = RECNO()
GO TOP
lnFirstRec = RECNO()
GOTO lnRetRec

DO CASE
CASE RECOUNT() <= 1
* No records or one record, disable all vcr buttons
CASE lnRetRec = lnLastRec
* At last record. Disable next and last. Enable first and previous.
CASE lnRetRec = lnFirstRec
* At first record. Disable previous and first. Enable next and last.
OTHERWISE
* In the middle somewhere. Enable all.
ENDCASE
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform