1. Home
  2. Foxit Quick PDF Library
  3. Generate PDF report from MS Access application coded in Visual Basic

Generate PDF report from MS Access application coded in Visual Basic

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\DebenuPDFLibraryAX1312.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
Updated on April 10, 2017

Was this article helpful?

Related Articles

Ready to try Foxit PDF SDK?
Click the link below to download your trial
Free Trial