Hello,
I'm trying to display a PDF on an Access report. I've researched the issue but I can't get it to work. Most people say to use the Web Browser ActiveX control. Which I've done but nothing appears. I've also tried using the Adobe Acrobat DC Browser ActiveX control but with no joy either.
I have the location of the PDF in an Access table as an attachment. Here's my code to fetch and display it using the Web Browser ActiveX control:
Private Sub Report_Load()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim rstChild As DAO.Recordset
Dim FilePath As String
Set db = CurrentDb()
Set rst = db.OpenRecordset("SELECT tblXML.PK, tblXML.XMLPath, tblXML.FileName, tblXML.LoadDate, tblXML.AttachedFile FROM tblXML WHERE (((tblXML.PK)=1));")
Set rstChild = rst.Fields("AttachedFile").Value
FilePath = "C:\Temp" & "\Preview.pdf"
If (Dir(FilePath) <> "") Then Kill FilePath
rstChild.Fields("FileData").SaveToFile FilePath
Me!PreviewBrowser.Navigate (FilePath)
rst.Close
End Sub
This code extracts the PDF and saves it to a temporary location where it should be picked up with the "Navigate" function. The file is created but nothing appears in the control.
Can someone please help me with this?
Thank you very much.