On 11 Giu, 03:25, septimus <ovengra...@yahoo.com> wrote:
On Jun 10, 8:36 pm, septimus <ovengra...@yahoo.com> wrote:
I am getting the same error and the file name is correct, trying to post a two page pdf in a folder and get the cancel 2501 error. Any suggestions. Works for all other reports except my two page report.On Jun 10, 6:21 pm, "Albert D. Kallal" <PleaseNOOOsPAMmkal...@msn.com> wrote:
"septimus" wrote in message
news:49a1b4ae-a663-48a4...@hd10g2000vbb.googlegroups.com...
When I use the following line of code to publish the report to PDF a >single time, it works:
DoCmd.OutputTo acOutputReport, "rptIAR", acFormatPDF, strPath
The above leaves the report open. Place a command to close the report, like
this:
DoCmd.Close acReport,"rptIAR"
DoEvents
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
Pleasenospam_kal...@msn.com
No, sorry, I think the way I phrased that was misleading. The report never opens, so I can't close it using "DoCmd.Close". The first time
the code loop gets to the OutputTo command it says "Now Outputting 'rptIAR' to the file '[path].pdf'" and goes through all pages of the report before I get the "action canceled" error.
What I meant when I said "When I use the following line of code to publish the report to PDF a single time it works" is that if I place
that line of code (the OutputTo command) in a different procedure with
no loop, it works.
But in this context, it doesn't even matter what report I'm
outputting, I still get the "cancel" error. Why does Access think I'm canceling the output?? Here's the code in case it helps:
'Start looping through records.
Do While Not rstGrouping.EOF
'Populate the recordsource of the report.
PopulateAnswerCounts "Interim", rstGrouping
'Build the path and file name of the PDF we're producing.
strPath = BuildFilePath("Interim", Me)
'Publish the report in PDF format.
DoCmd.OutputTo acOutputReport, "rptIAR", acFormatPDF, strPath, False
rstGrouping.MoveNext
Loop
Found the problem. Turned out to be just an invalid character in the
file name. Thanks for your assistance.- Nascondi testo citato
- Mostra testo citato -What's the code for PopulateAnswerCounts and BuildFilePath?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 491 |
Nodes: | 16 (2 / 14) |
Uptime: | 111:35:29 |
Calls: | 9,684 |
Files: | 13,725 |
Messages: | 6,175,875 |