Lebans ReportToPDF

P

Patrick Jackman

I'm integrating ReportToPDF code into a form in my application and my call
to ConvertUncompressedSnapshot is returning false but the pdf's are being
created ok. Has anyone experienced this?

That section of my approach is below.

Patrick
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Patrick Jackman
Microsoft Access Developer since 1994
Vancouver, BC

Private Declare Function ConvertUncompressedSnapshot Lib "StrStorage.dll"
(ByVal UnCompressedSnapShotName As String, ByVal OutputPDFname As String,
Optional ByVal CompressionLevel As Long = 0, Optional ByVal PasswordOwner As
String = "", Optional ByVal PasswordOpen As String = "", Optional ByVal
PasswordRestrictions As Long = 0, Optional ByVal PDFNoFontEmbedding As Long
= 0) As Boolean

' Other Declares snipped.

' Work in the user's temp folder
strWorkPath = Space(cPathLen)
lngRet = GetTempPath(cPathLen, strWorkPath)
' Chop off NULLS
strWorkPath = Left(strWorkPath, lngRet)

' Create all the snapshots
For Each objDoc In mcolDocs
With objDoc
If Len(.WhereCondition) Then
strArgs = "IsPDF=-1;Filter=" & .WhereCondition & ";"
End If
If Len(.ReportOpenArgs) Then
strArgs = strArgs & .ReportOpenArgs
End If
Call ReportOpenArgs(strArgs)
DoCmd.OutputTo acOutputReport, .ReportName, acFormatSNP,
strWorkPath & .ReportName & ".snp"
End With
Next
DoEvents

' Convert to individual PDFs
For Each objDoc In mcolDocs
With objDoc
Kill strWorkPath & .ReportName & ".pdf"
lngRet = SetupDecompressOrCopyFile(strWorkPath & .ReportName &
".snp", strWorkPath & .ReportName & ".tmp", 0&)
If lngRet <> 0 Then
MsgBox cErrMsg, vbExclamation, "Could Not Decompress"
GoTo DocsEmail_Exit
Else
Kill strWorkPath & .ReportName & ".snp"
End If
DoEvents
If ConvertUncompressedSnapshot(strWorkPath & .ReportName &
".tmp", strWorkPath & .ReportName & ".pdf") Then
MsgBox cErrMsg, vbExclamation, "Could Not Create"
GoTo DocsEmail_Exit
Else
Kill strWorkPath & .ReportName & ".tmp"
End If
DoEvents
End With
Next
 
P

Patrick Jackman

Wow. Now I feel more than a little foolish. Thanks for the review Stephen.

Patrick.

"Stephen Lebans" <[email protected]>
wrote in message
Your Boolean logic is backwards,

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

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