Just to give an update on this:
I think you are all correct with your suggestions. It seems that the escape key does not actually interrupt the currently running statement, therefore, there is no-need to re-run it using retry.
So, I have removed my retries, which fixes the nesting errors.. problems solved!
Thanks
Will
>Hi All,
>
>Thanks for the responses.
>
>Maybe i mis-understood the usage of retry.
>Imagine this scenario:
>a loop is running which performs 10 long running queries.
>When user presses Esc, it will cancel one of the queries mid-run, therefore no results are produced for that query.
>
>If I return from the EscapeKey function, won't it skip to the next record in the loop, therefore my result set will only have 9 queries instead of 10?
>
>From the VFP Help:
>However, if a procedure specified with ON ESCAPE includes RETRY, the program line that was executing when you pressed ESC executes again
>
>In practice, when I tested my above theory, this was not the case.. but it did seem logical to me.
>
>As for Jims "single exit point" coding, I agree this is a best practice which should be used.
Will Jones