Cathy,
Bravo, a woman after my own heart. I once did something like this for my own sake during debugging, and the customer, much to my surprise, flipped. They loved it.
I did it this way:
1. Launch a form with a listbox (or put the listbox and finalizing code in the current form)
2. As you process, put messages in the cursor, updated in the listbox. One nice trick is to be able to print out the log afterward. Also nice are elapsed time, and generally any kind of tidbits they might conceivably want to know.
3. At various stages in the processing code, execute a "DoEvents" command, which makes your form responsive to the user, so they can click on the [CANCEL] button.
4. The cancel button should set a form property which you are checking periodically throughout the process. If the user has
All of this chews up cycles, but not many, and the user response to the display and control more than makes up for any slowdowns.
Here is a trick that slows down a COPY TO a little bit, but allows the user complete control.
LOCAL IWillCauseAnError
LOCAL lnError
lnError = 0
ON ERROR lnError = -1
COPY .... FOR IIF(NOT MyCancelFlag,.t.,EVAL(IWilLCauseAnError))
IF lnError = -1
ENDIF
I've never tried it with a SQL Select, but it ought to work, though it may need some tweaking.
One problem with the above is that the form does not respond, so you need to put a DoEvents into it. But if you do that, the things slows to an absolute crawl, so you can do something like:
COPY .... FOR IIF(MOD(RECNO(),1000)=0,MyDoEvents(),.t.)
PROCEDURE MyDoEvents
KeyBoard {ALT+F}
DoEvents
RETURN .t.
Hope this helps.
>I have a form where the user enters a Job Number that needs to be finalized. After they've entered the Job Number and pressed the "Finalize" button, the following is what I want to happen -- I'm just not sure how to approach this.
>
>As I process the data, I will be writing warning and error messages to a cursor. I want these to appear on the form as well, maybe in a grid or something, as the processing is occurring. I want the user to be able to scroll thru this grid (or whatever) while the processing continues so they can monitor the progress without
>interferring with it. I also want the user to be able to press a "Cancel" button at any time to stop the processing.
>
>How would I approach this?