>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