* Need a loop that can be exited by keystroke ON KEY LABEL ESCAPE llCancel = .T. llCancel = .F. lnCnt = 1 DO WHILE NOT llCancel * Lots of code here lnCnt = lnCnt + 1 IF MOD(lnCnt,100) = 0 DOEVENTS ENDIF ENDDOThe DoEvents will cause Fox to process the even queue and see the key press. DoEvents slows things down though so I only execute it every 100 times through the loop. You can adjust the 100 to whatever gives you the responsiveness to the keywborad you want wihtout slowing the loop too badly.