IAC – Opening a PDF from an Access table

How to open a PDF file with Reader from an Access table.

This code sample is posted here for the general benefit of the PDF development community. Attribution and usage guidelines are as noted in the code source; please respect the wishes of the author when using this code.


Option Compare Database

Option Explicit

Sub OpenEachFileInTable()

On Error GoTo ErrorHandler

Dim db As Database

Dim rs As Recordset

Set db = CurrentDb

Set rs = db.OpenRecordset('Filenames')

Do Until rs.EOF

' Start Acrobat Reader

Shell 'c:acrobat3ReaderAcroRd32.exe ' + rs('strFilename'), vbHide

rs.MoveNext

Loop


' Cleanup

rs.Close

Set rs = Nothing

Set db = Nothing


Exit Sub

ErrorHandler:

' Display error message

MsgBox Err.Description

Resume Next

End Sub

You May Also Like

About the Author: Planet PDF Team

Leave a Reply