The Cancel buttons "Cancel" property must be set to true. Then you can check Lastkey() = 27 before running the validation code.
PF
>>>Hi folks!
>>>
>>>I have a bit of a quandry here. I have code from a pre-existing project. This is the problem...
>>>
>
>-snip-
>
>>>OK.... is the problem that the Employee Code field is still keeping focus, and therefore no way (as it stands) to exit at this point? What am I overlooking, and have any of you run into this behavior?
>>>
>>>Thanks!!!
>>>
>>>Tommy
>>
>>Tommy,
>>
>>I think you must have the Cancel button Default property set to .T. for you to even select it before the validation of the field is completed. So your choices are to not call the confirmation window or set the Default to .F. and force the user to enter a valid code.
>>
>>HTH,
>
>Well, the Cancel button Default Property is .F. . I am able to select it with the mouse, even when the employee code field of the grid has focus. When I select the Cancel button, is when the system window for verifying my Cancel choice comes up.... and the hang-up.
>
>I guess I am forced to do some fancy coding to DISABLE the Cancel button while the Employee Code has focus.
>
>Thanks!
(On an infant's shirt): Already smarter than Bush