Michel,
Try putting DOEVENTS within your loop, and have your cmdCancel.Click() event set a property, like 'lCancelled'. Then, before continuing with the process, verify that lCancelled is FALSE.
HTH
Mark
>User want to be able to stop process when they click on a "cancel" button for exemple. I am able to stop a method with "ON KEY LABEL" command but i am not able to stop with mouse click on a button or command ON KEY LABEL LEFTMOUSE. Is ther e a way to put a button cancel on a form that will stop a task.
"It hit an iceberg and it sank. Get over it."
Robert Ballard, dicoverer of the Titanic wreckage.