Results 1 to 13 of 13
  1. #1
    Join Date
    Feb 2010
    Location
    Yorkshire UK
    Posts
    76

    Unanswered: Email reports as a PDF

    Hi,
    I have followed links on this subject but can not seem to find an answer. I am e-mailing reports in my application by using this code behing a command button.

    DoCmd.SendObject acSendReport, "rptSalesOrder", acFormatRTF, , , , "Test"

    I now want to send the report as a PDF and not RTF. I have software called PDF FACTORY which converts reports into PDF's. What should the code behind my command button now be?

    acFormatPDF does not work.

    Thanks
    Simon

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I assume you're using a version prior to 2007 (which has PDF capability built in)? In that case, you'd need to create the PDF file using whatever means, then email it using automation:

    Using Automation to Send a Microsoft Outlook Message
    Paul

  3. #3
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by Jabber View Post
    Hi,
    I have followed links on this subject but can not seem to find an answer. I am e-mailing reports in my application by using this code behing a command button.

    DoCmd.SendObject acSendReport, "rptSalesOrder", acFormatRTF, , , , "Test"

    I now want to send the report as a PDF and not RTF. I have software called PDF FACTORY which converts reports into PDF's. What should the code behind my command button now be?

    acFormatPDF does not work.

    Thanks
    Simon
    Simon,
    I did a quick gooble and found this for you:

    "you can use VBA to set registry values to provide filenames/locations and print 'silently' without user intervention. "
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  4. #4
    Join Date
    Feb 2010
    Location
    Yorkshire UK
    Posts
    76
    Wow. This is not looking like an easy thing to do. I am going to have study this at length. Thanks again.

  5. #5
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by Jabber View Post
    Wow. This is not looking like an easy thing to do. I am going to have study this at length. Thanks again.
    You're welcome!

    We will be here if you need any further assistance.
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  6. #6
    Join Date
    Feb 2010
    Location
    Yorkshire UK
    Posts
    76
    OK I have tried both Functions suggested by PBaldy and HiTechCoach and neither seems to work. The Function shown on PBalds link give me a compile error "user defined type not defined"
    and highlights

    dim ObjOutlook as Outlook.Application

    I also get comiler errors with HiTech but my VBA skills are not up to following the function and working out why it does not work. Is there a simpler function that is out there that I could follow?


    To recap, I have PDF Factory and I want a command button to send a report via e-mail as a PDF.

  7. #7
    Join Date
    May 2010
    Posts
    601
    the compiler error was probably caused by needing to set a reference to the outlook library. In the VBA editor on the menu go to Tools > References
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  8. #8
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    As Boyd noted, the compile error would be due to the requirement for the Outlook library (steps 4 & 5 on that link, though the version could be different). You could also use late binding, which would make it more version independent:

    Late Binding in Microsoft Access
    Paul

  9. #9
    Join Date
    Jun 2010
    Posts
    9
    I use Access 2007 which generates PDF reports so you don't need a 3rd party product for that.

    I then use Total Access Emailer from FMS (Microsoft Access Email sent from your Access Databases with Merged Data and Reports in HTML) which automatically sends filtered Access PDF reports to each email address. It has a VBA call that lets you add it to a button or event.

    Hope this helps.

  10. #10
    Join Date
    Feb 2010
    Location
    Yorkshire UK
    Posts
    76
    I am following HiTech's link. I have set a reference to the outlook library but my compiler stops at:

    Dim lngRetVal As adhRegErrors

    Compiler error
    User Defined type not defined.

    Is there another library I need to add to the list?

  11. #11
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by Jabber View Post
    I am following HiTech's link. I have set a reference to the outlook library but my compiler stops at:

    Dim lngRetVal As adhRegErrors

    Compiler error
    User Defined type not defined.

    Is there another library I need to add to the list?
    The adhRegErrors is probably a constant define someplace else in their database that was not part of the snippet of VBA code.

    The adh prefix mean the code probably came fromt he Access Developer's Handbook on how to read and write to Window's registry.

    Do you have VBA code for reading/writing to the Window's registry?
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  12. #12
    Join Date
    Feb 2010
    Location
    Yorkshire UK
    Posts
    76
    I have decided to either forget about PDFs or use Access 2007 as this is far beyond my level. Thanks for your help anyway.

  13. #13
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by Jabber View Post
    I have decided to either forget about PDFs or use Access 2007 as this is far beyond my level. Thanks for your help anyway.
    I find that with Access 2000-2003, creating PDF's from report is very easy using this free tool:

    ReportToPDF


    I use this even if there is Adobe Acrobat or some other PDF print driver installed.
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •