local lcOnError, llError lcOnError = on("error") && save previous ON ERROR IF USED("mytable") AND ISEXCL("mytable") SELECT mytable on error llError = .T. PACK <-------- this part is giving error on error &lcOnError && restore previous ON ERROR if llError MessageBox("Unknown error during PACK.") endif USE IN mytable ENDIFYou can also use aerror() to get more specific information about the last error.