VBA Limit

J

jim

We have a VBA application running within Access which opens a Word document,
establishes an ADODB connection to a SAS data set, and populates numbers in
MSgraph objects in the Word document. The VBA program loops through the
records in the data set and saves the Word document with a unique name at
each iteration. The program is supposed to generate 300+ unique documents,
but stops running after about 60 docs (approximately 90 minutes). It stops
with run time error 5360, "The server application, source file, or item
cannot be found." It does not always stop at exactly the same line in the
program. Everything works fine as long as we run only 50-60 documents at a
time, so there must not be anything inherently wrong with the code or the
data.

We are using Access 2007 on Windows XP Pro, but the problem also existed
with earlier versions of Access. Bypassing some of the code causes the
program to run through more documents, but it still stops after about the
same length of time. Adding code causes it to stop after fewer documents are
processed.

Is anyone aware of some kind of limit that we are running up against with
this application?

Thanks,
Jim
 
J

Jack Leach

Are you utilizing DoEvents in the code? DoEvents stops your code until the
system catches up with it. Often you will see it used three times in a row
(because sometimes once just isn't enough <g>)

DoEvents: DoEvents: DoEvents

hth

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
T

Tony Toews [MVP]

jim said:
We have a VBA application running within Access which opens a Word document,
establishes an ADODB connection to a SAS data set, and populates numbers in
MSgraph objects in the Word document. The VBA program loops through the
records in the data set and saves the Word document with a unique name at
each iteration. The program is supposed to generate 300+ unique documents,
but stops running after about 60 docs (approximately 90 minutes). It stops
with run time error 5360, "The server application, source file, or item
cannot be found." It does not always stop at exactly the same line in the
program. Everything works fine as long as we run only 50-60 documents at a
time, so there must not be anything inherently wrong with the code or the
data.

Are you closing the various objects you are opening? Is there any
suspicious in Task Manager when the code halts? Extra processes?
Lots of RAM or resources consumed?

Tony
 
J

John Spencer

Without seeing the code it is impossible to tell you what could be wrong
(if anything). It could be that you are opening many documents and not
closing them in the loop. Or it could be that your code needs to pause
every once and a while to let the operating system catch up. Or ...

Or your code could be good and not have any problems at all. We don't know.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top