<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2800.1141" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2>Rocky,</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2>You
can use DoEvents and a "Cancel" button.</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2>Create
a Cancel button (cmdCancel) and when you press it, place the word "Cancel" in
the button's Tag Property. Also, in the button that begins the processing
place a line of code before the processing starts that says
cmdCancel.Tag="". This way, if you have cancelled the process and want to
restart it, the cancel button's tag property is reset.</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003></SPAN> </DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2>If you are running queries, just after each query add two lines
of code</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2><SPAN
class=278461800-07042003><FONT face=Arial color=#0000ff
size=2> DoEvents</FONT><FONT face="Times New Roman"
color=#000000 size=3> </FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2><SPAN
class=278461800-07042003></SPAN> If cmdCancel.Tag="Cancel"
then Exit ' (or a GoTo Exit Label)</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2>If you
are running a loop then add the same two lines just after you start the
loop</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2>For i
= 1 to Total</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2><SPAN
class=278461800-07042003><FONT face=Arial color=#0000ff
size=2> DoEvents</FONT><FONT face="Times New Roman"
color=#000000 size=3> </FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2><SPAN
class=278461800-07042003></SPAN> If cmdCancel.Tag="Cancel"
then Exit ' (or a GoTo Exit Label)</FONT></SPAN></DIV></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2> ...</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2>Next
i</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2>or
</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2>Do
while not rs.eof</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2><SPAN
class=278461800-07042003><FONT face=Arial color=#0000ff
size=2> DoEvents</FONT><FONT face="Times New Roman"
color=#000000 size=3> </FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2><SPAN
class=278461800-07042003></SPAN> If cmdCancel.Tag="Cancel"
then Exit ' (or a GoTo Exit Label)</FONT></SPAN></DIV></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2> ...</FONT></SPAN></DIV></FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2>loop</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff size=2>As JC
stated, you cannot stop a query once it has started, but you can stop a process
immediately after a query has finished. I've used this procedure quite a
bit to do exactly what you are trying to do.</FONT></SPAN></DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=278461800-07042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV><!-- Converted from text/rtf format -->
<P><B><I><FONT face="Times New Roman" color=#0000ff size=4>John V.
Ruff</FONT><FONT face="Times New Roman" size=4> – </FONT><FONT
face="Times New Roman" color=#008080 size=4>The Eternal Optimist</FONT><FONT
face="Times New Roman" size=4></FONT> <FONT face=Wingdings color=#800080
size=4>J</FONT></I></B> <BR><I><FONT face="Times New Roman">Always Looking For
Contract Opportunities</FONT></I> </P>
<P><B><FONT face="Times New Roman" color=#000080 size=2>“Commit to the Lord
whatever you do,</FONT></B> <BR><B>
<FONT face="Times New Roman" color=#000080 size=2>and your plans will succeed.”
Proverbs 16:3</FONT></B> </P>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
accessd-bounces@databaseadvisors.com
[mailto:accessd-bounces@databaseadvisors.com] <B>On Behalf Of </B>Rocky Smolin
- Beach Access Software<BR><B>Sent:</B> Sunday, April 06, 2003 10:37
AM<BR><B>To:</B> AccessD@databaseadvisors.com<BR><B>Subject:</B> [AccessD]
Stop That Code!<BR><BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Dear List:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>What's the simplest way to accomplish
this?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>MTIA,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Rocky Smolin<BR>Beach Access
Software</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BLOCKQUOTE></BODY></HTML>