Hi. I've got a program printing multiple pdf reports, and I need to
wait for completion of various associated operations- The pdf printer
prints to one file, then I need to copy that where I need it, then
delete the old file, repeat with the next report. I need to wait for
each step to complete or I get errors due to the previous thing being
open and not done yet.
Is there any elegant way to do that? My FileCopy in particular has
problems. I set up a goto error loop to catch an error due to an open
file, do an api sleep for a second or two, and try again- but it
appears to pass by the loop before it's really done somehow, and I get
a permission error anyway.
Any input or pointers to where to look is welcome, thanks a bunch.
-Ann 9 5850
You may need to add a few DoEvents commands to force the application to
complete one task before starting another. If you put them
immmediately after a statement that seems to be causing your problems
that should solve that one. Add one at at time and see if that helps
you get further in your processes.
<<The pdf printer prints to one file, then I need to copy that where I need
it, then delete the old file, repeat with the next report. >>
Put all these processes in a function and put the function in a loop where
you feed in all the parameters. Access will execute everything in a function
before moving on to succeeding code (in this case the next report).
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications re******@pcdatasheet.com www.pcdatasheet.com
<ca******@csd.net> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com... Hi. I've got a program printing multiple pdf reports, and I need to wait for completion of various associated operations- The pdf printer prints to one file, then I need to copy that where I need it, then delete the old file, repeat with the next report. I need to wait for each step to complete or I get errors due to the previous thing being open and not done yet.
Is there any elegant way to do that? My FileCopy in particular has problems. I set up a goto error loop to catch an error due to an open file, do an api sleep for a second or two, and try again- but it appears to pass by the loop before it's really done somehow, and I get a permission error anyway.
Any input or pointers to where to look is welcome, thanks a bunch.
-Ann
Thanks very much for the suggestions. DoEvents didn't seem to affect
anything, my code still proceeded before the report was done with its
async printing to a pdf file.
I was intrigued with the thought that I could put the report open in a
separate function, but that didn't work for me, either. The report,
opened from a separate function in a separate library, was still
printing, my filecopy command after the function came back took it
early, and wound up with an empty pdf file after copy in the copy
destination.
I was wrong about where the fail was, it is that the report print is
not completed before a subsequent filecopy tries to get hold of it and
copy it to a new location. I'll update you with anything I find. I
may just have to introduce X seconds of wait time in between reports
and hope to guess a good value for that. This is what the DoEvents
documentation says to do.
Thanks again,
Ann
Try putting the open report and print to PDF in a function and then do the
filecopy and kill outside the function. Include all this in the loop to do
multiple reports.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications re******@pcdatasheet.com www.pcdatasheet.com
<ca******@csd.net> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com... Thanks very much for the suggestions. DoEvents didn't seem to affect anything, my code still proceeded before the report was done with its async printing to a pdf file.
I was intrigued with the thought that I could put the report open in a separate function, but that didn't work for me, either. The report, opened from a separate function in a separate library, was still printing, my filecopy command after the function came back took it early, and wound up with an empty pdf file after copy in the copy destination.
I was wrong about where the fail was, it is that the report print is not completed before a subsequent filecopy tries to get hold of it and copy it to a new location. I'll update you with anything I find. I may just have to introduce X seconds of wait time in between reports and hope to guess a good value for that. This is what the DoEvents documentation says to do.
Thanks again, Ann
Thanks. No, no luck with putting the pdf in a separate function. I
tried putting the function in the local module instead of a separate
library, still no success.
I also tried writing a text file during the report Close event, but the
text file appears before the pdf file even begins to write.
However, I see that the pdf driver creator, pdf995, has a relevant
question in their developer faq at http://www.pdf995.com/faq_dev.html,
titled "How do I use a ProcessPDF handler to programmatically determine
when a pdf is complete?". This has some code examples concerning
updating a pdf995-specific ini file, with the name of an application
that pdf995 will run when it is finished printing. This seems the
proper way to do it, though it locks us in to the pdf995 printer
driver, something I hoped to avoid. It's rather over my head, but
there is example code there that I will try.
Best,
Ann
Hi. I found some further help here: http://www.freeware995.com/misc/vbacode.txt. This code was
specifically tailored for ms access. I made a few adjustments for my
situation, e.g. I don't need to reset the ini files in between every
report, but the code is solid, worked for me on a test run of 20-30
reports on a slow machine. I'm a happy camper. The code is
unattributed, but I'm grateful to whoever wrote it.
In summary, I abandoned the approach of using FileCopy to copy the pdf
report from a single pre-configured pdf report name, and instead
configured the different report names from within my program by
updating the pdf995 ini files, and printed directly to them that way.
There's also some wait checking code in this pdfwrite example that I
have left in with reduced times. I don't know if it's needed, but I
think it might be quite important.
Best,
Ann
On 23 Feb 2005 15:46:44 -0800, ca******@csd.net wrote: Hi. I found some further help here: http://www.freeware995.com/misc/vbacode.txt. This code was specifically tailored for ms access. I made a few adjustments for my situation, e.g. I don't need to reset the ini files in between every report, but the code is solid, worked for me on a test run of 20-30 reports on a slow machine. I'm a happy camper. The code is unattributed, but I'm grateful to whoever wrote it.
In summary, I abandoned the approach of using FileCopy to copy the pdf report from a single pre-configured pdf report name, and instead configured the different report names from within my program by updating the pdf995 ini files, and printed directly to them that way.
There's also some wait checking code in this pdfwrite example that I have left in with reduced times. I don't know if it's needed, but I think it might be quite important.
Best, Ann
Is it necessary for PDF995 to access the internet in order to print the report?
If I buy the key, will the program no longer try to access the internet?
Chuck
....
That's right, Chuck. It works quietly without loading IExplorer after
you buy and install the key. I found it's a good idea to figure out
whether the suite key is needed before buying- I needed the $19.95
pdfedit key as well as pdf995 for my code interface. If you get the
pdfedit key, the pdf995 app is also paid for.
Ann
On 3 Mar 2005 14:30:59 -0800, ca******@csd.net wrote: That's right, Chuck. It works quietly without loading IExplorer after you buy and install the key. I found it's a good idea to figure out whether the suite key is needed before buying- I needed the $19.95 pdfedit key as well as pdf995 for my code interface. If you get the pdfedit key, the pdf995 app is also paid for.
Ann
Thanks for the reply. $19.95 is perfectly acceptable. I just didn't want to
buy the key only to find out that the program still wanted to access the
internet.
Chuck
.... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: James |
last post by:
Hello All,
I have a stored procedure which will act like a main/controller script
which will then invoke more stored procedures (~20). Basically, it
looks something like below:
-- start...
|
by: Danny Masti |
last post by:
Hello,
I have a HIDDEN div with a "Please Wait Message". OnSubmit I show the
hidden div with the "Please Wait Message". It works fine. But if I
replace the "Please Wait Message" with an animated...
|
by: Andy |
last post by:
Hi folks,
I have following problem:
#include <map>
....
std::map<long, long> myMap;
myMap.
|
by: kuldeepiitk |
last post by:
Is there any way that i can make my application wait for some time so
that page loads in that time, right now I am using following code,
=================================
Public Sub...
|
by: Oded |
last post by:
Hi,
I'm working on an ASP.NET application, written in C#, using VS.NET .
When working on aspx pages, HTML completion does not work (neither tag
closing nor statement completion). Completion works...
|
by: jason |
last post by:
i am writing some simple web forms with VB.NET as the code-behind
language.
the code-behind files import a C# class library namespace from a .dll
which is in the references list.
however,...
|
by: Let_Me_Be |
last post by:
Currently I write most of the code in Vim, mainly because I can write
my code remotely using ssh, the problem is that I sometimes find myself
lost in the code, and for this I need good code...
|
by: Jason Zheng |
last post by:
This may be a silly question but is possible for os.wait() to lose track
of child processes? I'm running Python 2.4.4 on Linux kernel 2.6.20
(i686), gcc4.1.1, and glibc-2.5.
Here's what happened...
|
by: Lukasz Mierzejewski |
last post by:
Hi, I need help with pydev code completion...
Let's assume that we have something like this:
class One:
def fun(self):
return 1
class Two:
li =
|
by: Siddhant |
last post by:
Hi people.
I was just wondering if a tab-completion feature in python command
line interface would be helpful?
If yes, then how can I implement it?
Thanks,
Siddhant
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| | |