[AccessD] FW: Convert To PDF Problem

Robin Lawrence lawrence.robinr at gmail.com
Sat Feb 19 04:03:35 CST 2011


Hi Rocky,
Just a WAG - does the report which doesnt work have an external image in it?

I had a problem with this some time ago and found the answer here
http://bytes.com/topic/access/answers/658575-stephen-lebans-snapshot-pdf-solution

Regards
Robin

----- Original Message ----- 
From: "Rocky Smolin" <rockysmolin at bchacc.com>
To: "'Access Developers discussion and problem solving'" 
<accessd at databaseadvisors.com>
Sent: Saturday, February 19, 2011 1:49 AM
Subject: Re: [AccessD] FW: Convert To PDF Problem


> Dan:
>
> No soap.  The code us in a module and is a Public Function.
>
> And works perfectly when it is called from the form where I first
> implemented it.
>
> But when I call it from the second form it doesn't work.
>
> However, if I call it from the first form, the call it from the second 
> form
> then it DOES work in the second form.
>
> So the call in the first form is apparently creating some condition that 
> the
> second form doesn't.
>
> But danged if I can spot it.
>
> TIA
>
> Rocky
>
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
> Sent: Friday, February 18, 2011 10:19 AM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] FW: Convert To PDF Problem
>
> Hi Rocky,
>
> Two ideas to try:
>
> 1) Instead of "SnapshotFormat(*.snp)", try acFormatSNP (although they are
> probably equal).
>
> 2) Open an unrelated select query prior to the DoCmd.OutputTo line.  I 
> need
> to do this at one place in my code to get OutputTo to work.  Then close 
> the
> query later.
>
>    DoCmd.OpenQuery "qryAnySelectQuery"
>    DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, strPathandFileName
>    DoCmd.Close acQuery, "qryAnySelectQuery"
>
> HTH,
> Dan
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
> Sent: Friday, February 18, 2011 10:46 AM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] FW: Convert To PDF Problem
>
> Lambert:
>
> Thanks for the idea but it didn't seem to make any difference.  Still does
> not return to the next statement after the OutputTo.  But if I run the
> ConvertToPDF in the other form first, then it works when called from the
> second form.
>
> Very mysterious.
>
> Rocky
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
> Sent: Friday, February 18, 2011 7:07 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] FW: Convert To PDF Problem
>
>
> Hi Rocky,
>
> I honestly cannot remember how I worked this out, but I too had some
> problems when I first started to use the wondrous LeBans code for PDF
> production. For some reason it did not work unless the database window was
> (nominally) visible.
>
> I resolved the issues by adding a few lines of code around those two 
> lines.
>
> Lambert
>
> Leban's original code...
> ==========================================
>    ' Export the selected Report to SnapShot format
>    DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _
>       strPathandFileName
>
>    ' Make sure the process has time to complete
>    DoEvents
> ==========================================
>
> Here is my modified code. The additons are lines 200,210,230, 240 and 250.
>
> ==========================================
>        ' Export the selected Report to SnapShot format
> 200     DoCmd.Echo False
>        'Show the db window
> 210     DoCmd.SelectObject acTable, , True
>
> 220     DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _
>                       strPathandFileName
>
> 230     DoCmd.SelectObject acTable, , True
> 240     DoCmd.RunCommand acCmdWindowHide
>
>        'turn the echo back on
> 250     DoCmd.Echo True
>
>        ' Make sure the process has time to complete
>
> 260     DoEvents
> ==========================================
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
> Sent: Thursday, February 17, 2011 1:59 AM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] FW: Convert To PDF Problem
>
> Michael:
>
> I'm using Lebans' ConvertReportToPDF which is a Public Function and is
> included in a module named modReportToPDF which you can download form his
> site.
>
> This function is called from two places in the app and is called like 
> this:
>
> Call ConvertReportToPDF("rptRentalAgreement", , strRAPDFName, , False)
>
> So there are no declares in either of the two forms that call
> ConvertReportToPDF.  However, in Lebans' module here are a bunch of 
> Private
> Declares.  There are no duplicates of these Declares in other modules,
> however, public or otherwise.
>
> Is that what I'm looking for?
>
> TIA
>
> Rocky
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Michael Mattys
> Sent: Wednesday, February 16, 2011 9:00 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] FW: Convert To PDF Problem
>
> Hi Rocky,
>
> No, quite familiar actually.
> My turn to be vague ...
>
> You'll need to examine those declares again.
> One or more of your declares is being called by your form/report because 
> it
> is public and is probably a duplicate of a private declare that your code
> should be using.
> Even though they look the same, they are not - hence no functionality.
>
>
> Michael R Mattys
> Business Process Developers
> www.mattysconsulting.com
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
> Sent: Wednesday, February 16, 2011 11:40 PM
> To: 'Access Developers discussion and problem solving'
> Subject: [AccessD] FW: Convert To PDF Problem
>
> So here's what I've found out so far.  The  Convert to PDF routine is 
> called
> form two places in the program, one which has been working a long time -
> call it the old one - and the new one I added.
>
> If the new one is run before the old one, it stops executing at
>
> DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _
>       strPathandFileName
>
> Just never returns from this command.  Doesn't hang, you can go ahead and
> operate on the form. But contorl is never passed to the next statement.
>
> However, if you call the old one first, then the new one works.
>
> So the old one is apparently setting something somewhere that makes the 
> new
> one work.  But I can't see it to save my soul.
>
> Pretty vague, huh?  But all WAGs welcome.
>
> MTIA
>
> Rocky Smolin
> Beach Access Software
> 858-259-4334
> Skype: rocky.smolin
> www.e-z-mrp.com
> www.bchacc.com
>
>
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
> Sent: Tuesday, February 15, 2011 11:50 AM
> To: 'Access Developers discussion and problem solving'
> Subject: [AccessD] Convert To PDF Problem
>
> Dear List:
>
> I implemented Lebans' ConvertReportToPDF and it worked really well to 
> create
> a report as a PDF.  Then I implemented in another place in the code.  And 
> it
> doesn't work.  Same Call.  Passing the same parameters.  I step through
> Lebans' code line by line, watching all the variables.  When it gets to 
> the
> line
>
>    ' Export the selected Report to SnapShot format
>    DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _
>       strPathandFileName
>
> it doesn't comes back to the next line.  And no SNP file is created.
>
> The next line is:
>
>    ' Make sure the process has time to complete
>    DoEvents
>
> Stepping through the code when called from the place I first used it it
> steps just fine.  Does the output, creates the snp file and lights up the
> DoEvents.
>
> The header is to the module is:
>
> Public Function ConvertReportToPDF( _
> Optional RptName As String = "", _
> Optional SnapshotName As String = "", _
> Optional OutputPDFname As String = "", _ Optional ShowSaveFileDialog As
> Boolean = False, _ Optional StartPDFViewer As Boolean = True, _ Optional
> CompressionLevel As Long = 0, _ Optional PasswordOwner As String = "", _
> Optional PasswordOpen As String = "", _ Optional PasswordRestrictions As
> Long = 0, _ Optional PDFNoFontEmbedding As Long = 0 _
> ) As Boolean
>
> and the arguments passed to the routine are the same in both cases.
>
> I am truly baffled - don't even have a clue what to test.
>
> Any ideas, WAGs even, gratefully accepted.
>
> MTIA
>
>
> Rocky Smolin
>
> Beach Access Software
>
> 858-259-4334
>
> Skype: rocky.smolin
>
> www.e-z-mrp.com <http://www.e-z-mrp.com/>
>
> www.bchacc.com <http://www.bchacc.com/>
>
>
>
>
>
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com 




More information about the AccessD mailing list