Link to home
Start Free TrialLog in
Avatar of StampIT
StampITFlag for United States of America

asked on

Output Access 2007 Report to PDF generates Error 2282

Using the attached code I am trying to output a report to a pdf file in a specific location. The code generates however error 2282. "The format in which you are attempting to output the current object is not available."  Is it possible to do what I am attempting? Thank you.
Function TestPotRpt()

    Dim DateSuf As String
    Dim FPath As String
    Dim FName As String
    Dim FPN As String
    Dim Yr As String
       
    'Create DateSuf
    If InStr(1, Date, "/") = 2 And InStr(3, Date, "/") = 4 Then
        DateSuf = 0 & Month(Date) & 0 & Day(Date) & Format(Date, "yy")
    ElseIf InStr(1, Date, "/") = 2 And InStr(3, Date, "/") = 5 Then
        DateSuf = 0 & Month(Date) & Day(Date) & Format(Date, "yy")
    ElseIf InStr(1, Date, "/") = 3 And InStr(4, Date, "/") = 5 Then
       DateSuf = Month(Date) & 0 & Day(Date) & Format(Date, "yy")
    Else
        DateSuf = Month(Date) & Day(Date) & Format(Date, "yy")
    End If
    
    FPath = "\\Kermit\Potential\"
    
    FName = "PotDol"
    
    FPN = FPath & FName & DateSuf & ".pdf"
    

    DoCmd.OpenForm ("frmPot")   'Provide report date ranges
    DoCmd.OutputTo acOutputReport, "rptPotDaily2", acFormatPDF, FPN

End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You must also have the save as pdf addin loaded. http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=7

Kelvin
Avatar of StampIT

ASKER

I downloaded and installed "2007 Microsoft Add-in: Microsoft Save As PDF". Closed the database and reopened. I can now save the report to a PDF. Thanks for the help
That's what I was referring to ... just couldn't find the link ...

mx