Lebans ReportToPDF error when XP machine is locked

S

Sienayr

Greetings,

First, thanks to Mr. Lebans for his hard work and dedication,
especially for the ReportToPDF code.
Secondly, I have researched my problem in the groups and done extensive
testing before posting, so please forgive me if I have missed a post
that is relevant to my problem.

I am attempting to use the ReportToPDF code (newest release,751) to
replace some code that I have used in conjunction with PDF Writer 5,
which writes a path to a registry to prevent the Save dialog box from
popping up from the PDF Driver. My process is automated and kicks out
several PDF files from a database. It usually runs at night on a
locked PC, obviously required for security.

ReportToPDF dropped into my process to replace the old code and runs
perfectly as long as the PC is unlocked.

I precede the call to ConvertReportToPDF() with [DoCmd.OpenReport
ReportName, acViewPreview, , Filter] because I have to filter many of
the reports. It seems like the DoCmd.OpenReport isn't finishing and
the OutputTo is trying to run before the report is finished; I can see
the finished report on the screen when the error is thrown. I have
read about other filtering options, but rebuilding my entire code base
isn't really an option because several hundred reports are output
everyday and I am hoping I can just drop in ReportToPDF within the
existing process. Opening every report in Design view to set the
filter would bog down the process.

The problem is that when the process runs while the PC is locked, it
periodically throws a "There isn't enough memory to perform this
operation. Close uneeded programs and try the operation again."
message. This doesn't happen on the first report, but happens
eventually before all reports are output. The error seems to be
untrappable. When I click OK, the process continues unabated and
finishes with no problems. Since the same exact code runs through
perfectly when the PC is unlocked, I am inclined to believe that it
isn't truly a memory problem.

Operating system: Windows XP
Office version: XP
Report Database format: 2000

Here are a few things I have tried to fix the problem, to no avail:

Follow DoCmd.OpenReport with 1 or 2 DoEvents:
DoCmd.OpenReport ReportName, acViewPreview, , Filter
DoEvents
DoEvents
ConvertReportToPDF()

Precede the OutputTo call within ConvertReportToPDF with DoEvents

Follow DoCmd.OpenReport with a loop with DoEvents within the loop
DoCmd.OpenReport
For x=1 to 100
DoEvents
Next x
Call ConvertReportToPDF()
Have another DoCmd.OpenReport following the first one:
DoCmd.OpenReport ReportName, acViewPreview, , Filter
DoCmd.OpenReport ReportName, acViewPreview, , Filter
DoEvents
ConvertReportToPDF()

So far nothing has worked, if anyone can offer any other suggestions I
would greatly appreciate it.

Thanks for your time,
Ryan
 
J

John Milward

This might be a bit crude, but have you considered using the timer to call
each report?
If the timer interval is longer than the longest report takes it may fool
the system into thinking you are only doing one at a time.

HTH

John

Sienayr said:
Greetings,

First, thanks to Mr. Lebans for his hard work and dedication,
especially for the ReportToPDF code.
Secondly, I have researched my problem in the groups and done extensive
testing before posting, so please forgive me if I have missed a post
that is relevant to my problem.

I am attempting to use the ReportToPDF code (newest release,751) to
replace some code that I have used in conjunction with PDF Writer 5,
which writes a path to a registry to prevent the Save dialog box from
popping up from the PDF Driver. My process is automated and kicks out
several PDF files from a database. It usually runs at night on a
locked PC, obviously required for security.

ReportToPDF dropped into my process to replace the old code and runs
perfectly as long as the PC is unlocked.

I precede the call to ConvertReportToPDF() with [DoCmd.OpenReport
ReportName, acViewPreview, , Filter] because I have to filter many of
the reports. It seems like the DoCmd.OpenReport isn't finishing and
the OutputTo is trying to run before the report is finished; I can see
the finished report on the screen when the error is thrown. I have
read about other filtering options, but rebuilding my entire code base
isn't really an option because several hundred reports are output
everyday and I am hoping I can just drop in ReportToPDF within the
existing process. Opening every report in Design view to set the
filter would bog down the process.

The problem is that when the process runs while the PC is locked, it
periodically throws a "There isn't enough memory to perform this
operation. Close uneeded programs and try the operation again."
message. This doesn't happen on the first report, but happens
eventually before all reports are output. The error seems to be
untrappable. When I click OK, the process continues unabated and
finishes with no problems. Since the same exact code runs through
perfectly when the PC is unlocked, I am inclined to believe that it
isn't truly a memory problem.

Operating system: Windows XP
Office version: XP
Report Database format: 2000

Here are a few things I have tried to fix the problem, to no avail:

Follow DoCmd.OpenReport with 1 or 2 DoEvents:
DoCmd.OpenReport ReportName, acViewPreview, , Filter
DoEvents
DoEvents
ConvertReportToPDF()

Precede the OutputTo call within ConvertReportToPDF with DoEvents

Follow DoCmd.OpenReport with a loop with DoEvents within the loop
DoCmd.OpenReport
For x=1 to 100
DoEvents
Next x
Call ConvertReportToPDF()
Have another DoCmd.OpenReport following the first one:
DoCmd.OpenReport ReportName, acViewPreview, , Filter
DoCmd.OpenReport ReportName, acViewPreview, , Filter
DoEvents
ConvertReportToPDF()

So far nothing has worked, if anyone can offer any other suggestions I
would greatly appreciate it.

Thanks for your time,
Ryan
 

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

Similar Threads


Top