On a activate method for a page (4 pages on a single pageframe) I have code like
ON KEY LABEL F9 thisform.DoSomething
where DoSomething method contains
Invoice.pageframe1.page3.cmdAction.click (invoice is a form name, cmdAction is a command button)
First time I press F9 on a page everything works fine and code under command button executes. Code under command button is nothing special and strange.
Second time (and so on) pressing F9 cause fox error
"Object 'invoice' not found"
And now you know first hand why OKL's are not a very good idea. The reason is that they interrupt whatever code happens to be running at the time and execute - something that may have unpredictable results. A better idea would be to set the form's KeyPreview property to true and put code like this in the form's KeyPress() method:
IF nKeyCode = -8
thisform.DoSomething()
ENDIF