Back to Blog

    Developer Blog

    Generate PDF report from MS Access application coded in Visual Basic

    Foxit Quick PDF Library

    You can use Foxit Quick PDF Library with Microsoft Access and Visual Basic using either the DLL or ActiveX editions.

    There is also a knowledge base article which shows you how to generate a PDF report from a Microsoft Access database using C# and Foxit Quick PDF Library.

    Included below is a sample demonstrating how to use the ActiveX edition of Foxit Quick PDF Library with Microsoft Access and Visual Basic.

    Note: you will need to register the ActiveX edition of Foxit Quick PDF Library via the command prompt before you proceed.

    regsvr32.exe “C:\Program Files\Debenu\PDF Library\ActiveX\DebenuPDFLibraryAX[contentblock id=1 img=gcb.png].dll”

    Then you will need to add the ActiveX component that you’ve just registered as a reference to your Microsoft Access project.

    Private Sub Command2_Click()
    Dim ClassName
    Dim LicenseKey
    Dim FileName
    
    ClassName = "DebenuPDFLibraryAX1011.PDFLibrary"
    LicenseKey = "..."
    FileName = "1.hello-world.pdf"
    
    Dim QP
    Dim Result
    
    Set QP = CreateObject(ClassName)
    MsgBox ("Library version: " + QP.LibraryVersion)
    Result = QP.UnlockKey(LicenseKey)
    If Result = 1 Then
      MsgBox ("Valid license key: " + QP.LicenseInfo)
      Call QP.DrawText(100, 500, "Hello world from MS Access")
    
      If QP.SaveToFile(FileName) = 1 Then
        MsgBox ("File " + FileName + " written successfully")
      Else
        MsgBox ("Error, file could not be written")
      End If
    Else
      MsgBox ("- Invalid license key -")
      MsgBox ("Please set your license key by editing this file")
    End If
    
    Set QP = Nothing
    
    End Sub

    This article refers to a deprecated product. If you are looking for support for Foxit PDF SDK, please click here.