>>>>I have this in MyForm.LOAD, but it gives an error regarding that it cannot be used outside a form.
>>>>
>>>>
>>>>ON KEY LABEL ESC THISFORM.CloseFormESC()
>>>>
>>>
>>>Borislav's solution is the better one.
>>
>>Yes, it's better.
>
>Why?
ON KEY LABEL is kind of a global command. If you need a particular functionality for the form, it is much better to code its KeyPress event instead.
If it's not broken, fix it until it is.
My Blog