Solved

halt access macro

Posted on 1997-05-06
2
1,420 Views
Last Modified: 2006-11-17
I have a macro in Access that has about a HUNDRED steps. These steps are mostly "OpenQuery" commands. I would like to know how to stop/halt the macro in the middle of it. As far as I can tell, if I decide I want to stop the macro before it is finished I have to
KILL  the Access task itself! When the macro is running no menu item or anything else is selectable. I tried CTRL-BREAK and SHIFT-F5 but they didn't work. I know I can single step through the macro but with over a hundred steps in the macro, this is simply not an option.
HOW can I stop execution of macro without having to kill Access itself ?
0
Comment
Question by:massar
2 Comments
 
LVL 3

Accepted Solution

by:
ChrisLewis earned 50 total points
ID: 1008899
First of all, CTRL-Break DOES work, but you're probably hitting it while the queries are running, and its not stopping the macro correctly.  For more control, try these - User interaction:Create a function that brings up a msgbox with yes/no buttons, and return true/false based off the buttons.  Every 5 or 10 lines in your macro, add a line that stops the macro with the condition set to the function.  If you want to stop the macro, you just answer the dialog.  The problem with this is that you have to answer No if you want to continue, and you probably could achive the same results by spliting the macro up.No user interaction:First line of your macro, call a function that creates a junk file in your temp directory.Next, create a function that finds the temp file (using DIR$), and returns true if it exists.  Set the condition on every line in the macro (except the first) to the find function.  If you want to stop the macro, you just delete the file in filemanager/explorer.Try the Ctrl-Break again - it should work!
0
 

Author Comment

by:massar
ID: 1008900
I tried CTRL-BREAK again and it does appear to work. What was happening before is that before a query was run I would get a msg box asking me whether I wanted to update/delete/create table etc... I would
hit CTRL-BREAK at this point and expected the msg box to go away and the macro to stop but it wouldn't so I would kill Access. This time I hit CTRL-BREAK then answered no to the question and got the macro step dialog box with the halt/continue/step button and I just clicked on halt.
I hope this is the way it should work.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We recently endured a series of broadcast storms that caused our ISP to shut us down for brief periods of time. After going through a multitude of tests, we determined that the issue was related to Intel NIC drivers on some new HP desktop computers …
This is about my first experience with programming Arduino.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question