scan on error lHadError = .t. inser into ... on error if m.lHadError m.lHadError = .f. aerror(aErr) if aErr = err# ... endif endif endscan