Solved

Create Pdf Viewer in Access 2003

Posted on 2006-10-30
1
296 Views
Last Modified: 2012-06-22
Access 2003
adobe reader 6.0 +

What I have:
form called frmViewer
C:\PDF_Pages\    Dir with pdf files.
0001.pdf
0002.pdf    <--- correspond to Page numbers
etc.....

One Table
tblData
2 fields
fldData
fldPageNumber

Example:
Data          PageNumber
6CA60        0033
5AW23       1300
etc

On the form:
tblData --  Bound
One Textbox
txtLookUp  fldData
One Listbox
lstChoice   PageNumber

What I need:
I want to be able to type in the txtLookUp and the corresponding Page number will show Up in the lstChoice.

Then doubleclick on the lstChoice and the  pdf file from the dir of pdf files  will open up..


Example:
So if I'am looking for aan Item:
I type in    6CA60  and Page   0033 come up the listbox
I doubleclick on  0033 and the  0033.pdf file from the   C:\PDF_Pages\  
will open up

Thanks
fordraiders

 










0
Comment
Question by:fordraiders
1 Comment
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
Comment Utility
Howdo mate :)

Try this


on the afterupdate of txtLookup u want listbox populated

private sub txtLookup_AfterUpdate()
    lstChoice.RowSource = "SELECT PageNumber FROM tblData WHERE fldData = '" & Me.txtLookup & "'"
end sub



then on the click event, of the listbox, u want to show the PDF
Now we can do this one of two ways
U can open up PDF or create a viewer within your form

'Open up PDF

private sub lstChoice_DblClick()
    Dim sFile as String

    sFile = "C:\PDF_Pages\" & lstChoice.Value
    if dir$(sfile) <> "" then followhyperlink sFile else msgbox "File not found"
end sub


'Using viewe on form

on a form, add the following active x control

Adobe Acrobat Control for ActiveX

u may need to resize it to a larger size

Say its called pdf0

Now in code, u load a pdf using this syntax

Pdf0.LoadFile "full path of file"   e.g.   Pdf0.LoadFile "C:\EE\xx1.pdf"


so in your case

private sub lstChoice_DblClick()
    Dim sFile as String

    sFile = "C:\PDF_Pages\" & lstChoice.Value
    if dir$(sfile) <> "" then pdf0.loadfile sFile else msgbox "File not found"
end sub

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now