<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1141" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>John:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Brilliant! Simple and effective. Many
thanks.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Rocky</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=papparuff@attbi.com href="mailto:papparuff@attbi.com">John Ruff</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=accessd@databaseadvisors.com
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Sunday, April 06, 2003 5:26
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [AccessD] Stop That
Code!</DIV>
<DIV><BR></DIV>
<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>
<P>
<HR>
<P></P>_______________________________________________<BR>AccessD mailing
list<BR>AccessD@databaseadvisors.com<BR>http://databaseadvisors.com/mailman/listinfo/accessd<BR>Website:
http://www.databaseadvisors.com<BR></BLOCKQUOTE></BODY></HTML>