Why acFormatPDF cmd is not working in Access 2003

Ashfaque

Search Beautiful Girls from your town for night
Local time
Today, 18:28
Joined
Sep 6, 2004
Messages
897
Hi,

I used below vba code to to send email with PDF attachment in Access 2007 which works perfectly.

DoCmd.SendObject acSendReport, "R_TradeOrdAck", acFormatPDF, strMailList, , , .............

But since the db is installed at single pc user to work with Access 2003, the command acFormatPDF wont work. Instead acFormatSNP is working.

But I need acFormatPDF to work in Access 2003.

Is there any idea what to do with this?

Any help will be appreciated.

Tnx

Ashfaque
 
there is no pdf format option in A2003

before pdf format was built into access, i think most of us used a library provided by Stephen Lebans. I should have a look at that.
 
acFormatPDF is not registered in A2003, so you can not use it.

EDIT: as Gemma said, look for Stephen Lebans
 
Last edited:
BTW, if you are runnin .mdb file in a Acc2007 enviroment or higher, DoCmd.SendObject should work, just put in the real value of the constant acFormatPDF (I think it is "PDF Format (*.pdf)", please check it) it should create the PDF. It depends on the enviroment, tnot the file type.
 
Marlan,

Very good point. We get so used to the constants that we 'forget' that have a value. Just tried this and it worked a treat.
 
I've created a wrapper for Stephen Lebans function, I've changed it's name from ConvertReportToPDF to ConvertReportToPDForiginal:
Code:
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 PasswordOpen As String = "", _
Optional PasswordOwner As String = "", _
Optional PasswordRestrictions As Long = 0, _
Optional PDFNoFontEmbedding As Long = 0, _
Optional PDFUnicodeFlags As Long = 0 _
) As Boolean

    If Application.Version = 11 Then
        ConvertReportToPDF = ConvertReportToPDForiginal(RptName, , OutputPDFname, ShowSaveFileDialog, StartPDFViewer, , , , , , &H181000)
    ElseIf Application.Version > 11 Then
        DoCmd.OutputTo acOutputReport, RptName, "PDF Format (*.pdf)", OutputPDFname, StartPDFViewer
    End If
         
End Function
for running "DoCmd.OutputTo" if posible (here in the midle east we need RtL suport, leaban doesn't support well enough).
 
Thanks for all your help.

Regards,
 
I've created a wrapper for Stephen Lebans function, I've changed it's name from ConvertReportToPDF to ConvertReportToPDForiginal:
Code:
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 PasswordOpen As String = "", _
Optional PasswordOwner As String = "", _
Optional PasswordRestrictions As Long = 0, _
Optional PDFNoFontEmbedding As Long = 0, _
Optional PDFUnicodeFlags As Long = 0 _
) As Boolean
 
    If Application.Version = 11 Then
        ConvertReportToPDF = ConvertReportToPDForiginal(RptName, , OutputPDFname, ShowSaveFileDialog, StartPDFViewer, , , , , , &H181000)
    ElseIf Application.Version > 11 Then
        DoCmd.OutputTo acOutputReport, RptName, "PDF Format (*.pdf)", OutputPDFname, StartPDFViewer
    End If
 
End Function
for running "DoCmd.OutputTo" if posible (here in the midle east we need RtL suport, leaban doesn't support well enough).

I do this.

note that in thoery application.version is a string, not a number, but vba seems to accept a number.

it should really be

Code:
If Application.Version>="12" Then
     docmd.outputo etc
else
     use lebans code
end if
 

Users who are viewing this thread

Back
Top Bottom