>>>Thank you. But now I am wondering if, when I will be looking at the error log much later after the error occurred, if these values will make sense to me. Ideally it would be nice to know which button or grid or object where the user clicked last (that fired something that caused the error). But I don't know how to get it.
>>
>>Won't ASTACKINFO() give you everything in the stack - including the button click or whatever caused the error?
>>
>>Here is one way to use it:
https://stackoverflow.com/questions/3630819/in-foxpro-how-to-get-call-stack-info-for-logging>
>The reason I started this thread is I saw, in the error log of one of the customers, an entry about a problem is the KeyPress method of a text box. This KeyPress method has my code. In order for me to determine what caused the error and where I may need to change the code is to know what specific key the user pressed at the time of the error. And the ASTACKINFO() won't show this. As far as I know, only Lastkey() would capture this. Hence I need to record it into the error log.
You better read help for lastkey() function, IIRC it's the code of the key which caused .lostfocus() or end-of-Read in FPD/FPW terms. Not sure it's necessarily the last key pressed. I know we used it a lot in DOS days, and don't remember if I ever used it in VFP.