I have a section of code that retrieves a number (variable amount) of records from a database. Upon retrieval, the code loops through the records one by one and performs a number of functions with these records. This can sometimes take too long for an impatient user and they want to cancel out of the operation. What is the best to allow the user to press a cancel button left on the screen? Usually, when I am executing code, there is no interaction by the user allowed... Any suggestions would be greatly appreciated!!

Thank you.