Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Halting Macro (Exporting Delimited Text)????

Status
Not open for further replies.

scada101

Programmer
Oct 26, 2001
7
US
Hi,
I appreciate any help you can give.

I have a form that updates every few seconds. This form executes a Macro on a Timer Event of 5000 ms.

The Macro, exports delimited text to a file on the desktop. This is a small file, maybe 11 kb.

It all seems to work fine for a while, then at no specific interval, I get a "Halted Macro" error message.

The "Halted Macro" dialog box displays this message.
"text file already exists".

After I acknowledge the Halted Macro message, the macro will continue to run fine for a while longer.

My text file will update fine every 5 seconds until the "Halted Macro" error appears again.

Can you help?????
 
Try surrounding your call to the macro with the following:
DoCmd.SetWarnings False
DoCmd.RunMacro "macroname"
DoCmd.SetWarnings True

Let me know if this helps.

Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
I assume that it copies over the text file every five seconds, and succeeds most of the time. For the rare instance of it failing, consider that your macro 5 seconds ago hasn't finished and is still writing the file; thus it is still 'open'; thus it cannot be copied over; thus you receive the error message.


This is all guesswork.
 
Guess work or not foolio12's comments make sense.

Trying puting in an error handing routine and selecting for the error# with an if statement. Then you can put in a stop resume. This will allow you to manually(F8 key) retry and walk through the process to see if a little more time will allow you process to complete and continue with the next cycle.

If err = xxxx then
Stop
Resume
end if

Let us know if this helps you figure out your problem.

Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top