DoCmd.OutputTo acFormatPDF error in MDE

DCrake

Remembered
Local time
Today, 15:54
Joined
Jun 8, 2005
Messages
8,626
Situation is I am trying to create a demo that will be run under either 2003 or 2007 I have saved it as an MDE. When I pick a report to be output to pdf see below

Code:
Private Sub OutputReports()
Dim sSendObjectOutputFileType As String
    Dim sOutputToFileType As String
    Dim sOutputToFileTypeExtension As String
    Dim sVersionOfAccess As String
    If (SysCmd(SYSCMD_ACCESSVER)) = "12.0" Then
        sVersionOfAccess = "Access2007"
        sSendObjectOutputFileType = "PDF Format (*.pdf)"
        sOutputToFileType = [B]acFormatPDF[/B]
        sOutputToFileTypeExtension = ".pdf"
    Else
        sVersionOfAccess = "Access2003"
        sSendObjectOutputFileType = "SnapshotFormat(*.snp)"
        sOutputToFileType = acFormatSNP
        sOutputToFileTypeExtension = ".snp"
    End If
    Dim sOutputPath As String
    Dim sOutputFileName As String
    
    sOutputPath = CurrentProject.Path & "\"
    sOutputFileName = SnapReportName
    
    StrDefaultPathAndFileName = sOutputPath & SnapReportName & sOutputToFileTypeExtension
    If Dir(StrDefaultPathAndFileName) <> "" Then
        Kill StrDefaultPathAndFileName
        DoEvents
    End If
        
    DoCmd.OutputTo acOutputReport, SnapReportName, sOutputToFileType, sOutputPath & sOutputFileName & sOutputToFileTypeExtension, True
End Sub

When run as a mdb it works
When run as a mde it fails

Get the error

2282 the format in which you are attempting to output the current object is not available.

Any ideas
 
Have managed to get a workaround. Solution was to convert the mdb to accdb then convert the accdb to accde. Not happy as 2003 users cannot use it.
 

Users who are viewing this thread

Back
Top Bottom