Solved

Create Pdf Viewer in Access 2003

Posted on 2006-10-30
1
297 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
ID: 17834972
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

911 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