Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching pdf from table using code.

Status
Not open for further replies.

Lloyd1313

IS-IT--Management
May 20, 2002
20
CA
I have a table with a field that is an ole type. It stores a pdf. I'm trying to launch the pdf using VBA and haven't been able to find a way to do it.

Thanks.

Lloyd.
 
Hi, I can think of 3 possible ways:

1. Create a form based on your table where your .pdf files are kept(Record Source = TableName).

Create a Bound Object Frame (Control Source = OLE Field Name).

In Form View, double click on the Bound Object Frame, will open Acrobat with .pdf file in the current record.

2. Paste this behind a button:

Dim MyAppID
MyAppID = Shell("C:\Program Files\Adobe\Acrobat 4.0\Reader\AcroRd32.exe", 1) 'edit this to location of your Adobe

3. Paste this behind a button:

Dim objAdobe As Object, strFile As String
strFile = "C:\My Documents\Test.pdf" 'this could reference a control
Set objAdobe = GetObject(strFile)
objAdobe.Application.Visible = True
Set objAdobe = Nothing

For option 3 to work I think you will have to have the Full Version of Reader installed


 
Thanks for the reply.

I don't think it really answers my problem though.

The pdf is embeded in a table. I want to be able to find the record I want in a recordset and launch using the ole field in the table.

I've tried option 2 and the application opens fine but I couldn't find a way to automate the opening the pdf.

Lloyd.
 
You didn't mention finding records, can you post table name, field name to search on and OLE field, you wont be able to do a search on an OLE field.

What happened with option 3.

It's past midnight, so I won't be able to answer until tomorrow.

What version of Access, Location of Adobe Writer/Reader.
 
Option three woun't work as the pdf object is embeded in a table.

I'm using Access 2000 and Acrobat 5.0.

The path to Acrobat is d:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe

Lloyd.
 
Does option 3 work if you use it as in my example, substitute your own location and file name. You might get a solution tonight if it does. I've woken up a bit.

Can you post table name, field name to search on and OLE field name. As I said, a search can't be performed on an OLE field.

Ideally you will have a Text field with the location and file name of each embedded .pdf file.

Thanks Bill
 
Finding the record is no problem. The pdf is embeded not linked so a path doesn't exist. There is a text field to search on.

In my code I've used a snapshot recordset and have the record and field I want to launch from. It's just launching from the embeded object that is giving me trouble.

Lloyd.

 
My apologies for not reading your post correctly, the only method I am aware of to launch/edit embedded files is to double-click on a Bound Object Frame.

Good luck.
 
Hi Lloyd

Is it not possible to just use the Snapshot Viewer i.e. DoCmd.SendObject? Otherwise, can you not invoke the distiller print drivers?

Just a thought...

MoJoP
 
You might try this method if you are still looking,

Create form
Create control that references OLE object, obj
Create an event procedure for form_open that contains the following
obj.action = acOLEActivate

Have your code open the form to the record containing the pdf you wish to view, and it should launch Adobe when the form opens
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top