>>This has the same not-so-subtle bug as my example; if the table is empty, the INKEY() is never evaluated.. In addition, the scan continues to EOF if the Esc key is pressed, rather than aborting immediately.
>>
>>>Sincerely,
>
>Try modified version:
>
>lIsRun = .T.
>DO WHILE lIsRun
> SCAN While lIsRun
> IF INKEY() = 27
> lIsRun = .F.
> ELSE
> ... my main code is here
> ENDIF
> ENDSCAN
> lIsRun = (Inkey()#27)
>ENDDO
This will work if there are two ESC characters in the keyboard buffers - one to be eaten by the inkey() within the Scan loop, and the other one for the inkey() in the Do While loop. It will suffice to change the last lines to
ENDSCAN
lIsRun = (Inkey()#27) and lIsRun
ENDDO