Need to export access table into a pdf using VBA? Need a button inside a form.

Tagged: , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #239

    How could I export access table data into a pdf format using VBA? I need a button inside a form or in a report already have.

    DB man

    Here is the solution, there is a built-in function to export data into many formats in Access VBA. Following sample will be helpful you to customize and use your way.
    DoCmd.OutputTo acOutputTable, “Employees”, acFormatPDF, “Employee.pdf”, True
    Here you can use doCmd.outputTo function to export table (acOutputTable), query (acOutputQuery), forms (acOutputForm) or report (acOutputReport) into many formats. In my example I am going to export a table employees table and convert into PDF format.
    Following is the basic expression of outputTO function.
    OutputTo (“Object Type”, “Object Name”, Output Format, Output File Name/Path, Auto Start True or False, Template File if Need, Encoding If need true or False, Output Quality)
    So you can use this in a VBA function.
    Sub OutputPdf (item As String, cont As String)
    DoCmd.OutputTo acOutputTable, “Employees”, acFormatPDF, “Employee.rtf”, True
    End Sub

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.