[AccessD] Stop That Code!

Stuart McLachlan lexacorp at global.net.pg
Sun Apr 6 19:31:52 CDT 2003


>
> Dear List:
>
> I have some processes in an app which take a while to
> execute.  I generally put something on the screen to show
> the user that progress is being made. I'd like to give
> them the capability to abort the process by pressing the
> ESC key.  Maybe they used data selection criteria to
> select 12 records and instead selected 12,000.  Or made a
> mistake starting a long cost roll up or calculation which
> they'd like to abort.
> What's the simplest way to accomplish this?
>
DoEvents and a flag:

As an example, put a text box (txtDisplay) and two buttons
on a form and paste this into it:

Option Compare Database
Option Explicit

Dim flgFinish As Boolean

Private Sub Command0_Click()
flgFinish = True
End Sub

Private Sub Command1_Click()
Dim Counter As Long
Do
    Counter = Counter + 1
    txtDisplay = Counter
    DoEvents
Loop Until flgFinish
flgFinish = False
End Sub
--------------------------------------
   This Email Was brought to you by
               WebMail
    A Netwin Web Based EMail Client
  http://netwinsite.com/webmail/tag.htm


More information about the AccessD mailing list