Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Weird behaviour in form and table!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00063968
Message ID:
00063990
Vues:
54
Thanks Paul,

That did the trick.

AL


>>I've got some weird behaviour that I can't figure out. In my form, I have the following code in the cmdNext navigate button:
>>
>>*cmd next
>>
>>IF NOT EOF()
>> skip
>> thisform.Refresh()
>>ENDIF
>
>The problem is in the previous IF:
>
>You are on the last record.
>You SKIP, so, you're past the last record.
>You refresh the form. This will "empty" all controls on your form.
>
>You should test for EOF() before Refresh().
>
>>IF EOF()
>> =MESSAGEBOX("This is the last " + THISFORM.recordtype, MSGOKONLY + MSGEXCLAMATION, C_APPNAME)
>> GOTO BOTTOM
>> thisform.Refresh()
>>ENDIF
>>
>>This works fine except when I'm at the end of the table. In that case, when I click cmdNext, the form appears to move past the end of the file and I get a blank record on the screen. What I should be getting is the "This is the last . . ." message.
>>
>>This is the code in my form's refresh method:
>>
>>*form refresh
>>
>>if cu.active = .f.
>> thisform.txtin_date.visible = .t.
>> thisform.txtin_date.enabled = .f.
>> thisform.lblin_date.visible = .t.
>>else
>> thisform.txtin_date.visible = .f.
>> thisform.txtin_date.enabled = .f.
>> thisform.lblin_date.visible = .f.
>>endif
>>
>>
>>I then opened the table (191 records), positioned the record pointer on the last record (191) and from the command window typed SKIP. It actually skipped to phantom record 192 ??? (After issuing the SKIP, I typed ?recno() and got 192. What's happening here? When I type GO 192, I get "record out of range".
>
>When you're on eof, the RECNO() function always returns the total number of records + 1. But you cannot go to that record.
>
>If you want to position a table on eof, you must:
>
>GO BOTTOM
>SKIP
>
>Vlad (This is not part of the code :))
Al Williams

Anola MB, CANADA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform