>Since no one seems to know this answer, I did come up with a solution - AERROR.
>AERROR has the right error number.
>
>I think the cause of the error() not changing is when another ON ERROR is called. Why, I don't know.
>
From the VFP docs on ERROR()
Remarks
ERROR( ) returns the number of the most recent error. An ON ERROR routine must be active for ERROR( ) to return a value other than 0.
When an error is trapped during program execution, the error type can be returned by ERROR( ) in an ON ERROR routine. The corresponding error message can be returned by MESSAGE( ).
The value ERROR( ) returns is reset by RETURN or RETRY.
>>I am trying to trap the error when opening a table and I have noticed in the debugger that the error() doesn't change if I get an error. I corrupted the index on a table and when I open it I should get a 114 error number. Instead it stays at 0 and my handler doesn't work.
>>Any ideas?
>>TIA!