Hi,
I have an import routine initiated with a form. The form has a text box which points to external data that is required to update a table in the DB. The form has two buttons: a Cancel button and an Import button.
The import data is usually greater than 3500 records with multiple fields that need to be checked for change, so this routine can take some time as a function of processor speed. (On my new laptop it might take about 10-15 minutes; while on the user's older desktop it can take upwards of half-hour or so.)
If the Cancel button on the form is clicked before the routine is started, the form closes without executing the routine. When the Import button is clicked, the OnClick routine executes and initially a Msgbox is presented to the user warning of possible extended time required for the routine. The user can select Cancel from the Msgbox window (not the form), and the routine is not started.
However, I'd like the user to have the option of canceling the routine at anytime during the import process. (Part of the process updates a field on the form telling the user the record number of the total being processed.) The problem is once the routine is cycling through the data, the Cancel button on the form no longer is polled.
I've also tried to create another form containing only a Cancel button. That form opens on the desktop at the beginning of the import routine, The OnClick routine for the 'Cancel' form is supposed to set a global variable to true. As part of the import routine I check the global variable after each import record is updated. But this button too does not seem to be polled while the import process is running.
The routine itself is very code heavy with many branches and called subroutines. It works as coded very well; but I'd still like to give the user the option to cancel.
Right now, once the routine starts the only thing I can do is call up the Task Manager and cancel the process. This doesn't allow the DB to properly exit and do the required cleanup coded into the routine.
Any suggestions?
Thanks,
Vic
I have an import routine initiated with a form. The form has a text box which points to external data that is required to update a table in the DB. The form has two buttons: a Cancel button and an Import button.
The import data is usually greater than 3500 records with multiple fields that need to be checked for change, so this routine can take some time as a function of processor speed. (On my new laptop it might take about 10-15 minutes; while on the user's older desktop it can take upwards of half-hour or so.)
If the Cancel button on the form is clicked before the routine is started, the form closes without executing the routine. When the Import button is clicked, the OnClick routine executes and initially a Msgbox is presented to the user warning of possible extended time required for the routine. The user can select Cancel from the Msgbox window (not the form), and the routine is not started.
However, I'd like the user to have the option of canceling the routine at anytime during the import process. (Part of the process updates a field on the form telling the user the record number of the total being processed.) The problem is once the routine is cycling through the data, the Cancel button on the form no longer is polled.
I've also tried to create another form containing only a Cancel button. That form opens on the desktop at the beginning of the import routine, The OnClick routine for the 'Cancel' form is supposed to set a global variable to true. As part of the import routine I check the global variable after each import record is updated. But this button too does not seem to be polled while the import process is running.
The routine itself is very code heavy with many branches and called subroutines. It works as coded very well; but I'd still like to give the user the option to cancel.
Right now, once the routine starts the only thing I can do is call up the Task Manager and cancel the process. This doesn't allow the DB to properly exit and do the required cleanup coded into the routine.
Any suggestions?
Thanks,
Vic