Solved

Create Pdf Viewer in Access 2003

Posted on 2006-10-30
1
300 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

710 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