473,386 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Access/Acrobat PDF Viewer

18
I have an access database which has some text box as for input search citeria and a continous subform to display the search result.
Pls teach me in steps how to add a viewer (or active x control element) to see the corresponding pdf file link to the record.
Suppose the records in the ProjectRecord Form and has a field called imagelink which have the path of the pdf file.
Wish to have the code shown.
Thanks!
Feb 26 '08 #1
7 17729
sierra7
446 Expert 256MB
Hi
Assuming you have a command button called Command1 and can read the path and file name of the PDF document from a TextBox you will need something like this on the Click event.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Command1_Click()
  3. On Error GoTo Err_Command1_Click
  4.     Dim stAppName As String
  5.     Dim stPathFileName As String
  6.  
  7.     'Define path and file name of PDF document, keep .pdf extention
  8.     stPathFileName = Me!txtPathFile
  9.     stAppName = "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe " & stPathFileName
  10.     Call Shell(stAppName, 1)
  11.  
  12. Exit_Command1_Click:
  13.     Exit Sub 
  14. Err_Command1_Click:
  15.     MsgBox Err.Description
  16.     Resume Exit_Command1_Click
  17.  
  18. End Sub
  19.  
This obviously depends where your Acrobat reader file is located

S7
Feb 26 '08 #2
Fred Ho
18
If I have to add the active x for pdf file at the main form to display the first row of record at the subform, can it be done? or I have to click the row of record at the subform then display the corresponding pdf at the active x display? (The subform consists of a row of scroll down text boxes...)
How to do that in steps?
Besides, will it be a lot of acrobat buttons occupy the screen when I use the active x to open the pdf file at the main form? Can I control that just like for the tiff and jpg viewer (just picture and no other button eg zoom...etc.)?
For time being, I think I will need:
1. add the active x at the main form
2. I may need a code to add the text boxes (may be for the click event)...
3...
then I dont know how to make the code and also how to make the active x know how to display the corresponding pdf file when the user scroll down the subform or click the text box at the subform.
Hope that you can understand and really looking for any kindly help!
Thanks once again!
Feb 27 '08 #3
sierra7
446 Expert 256MB
Hi Jo

The code I showed in my last post was to start-up Adobe Acrobat in a separate window and automatically display the document specified in the Path. I thought it best to associate a command button with each record and then click to display the document as needed. This works.

I was not using ActiveX components and not trying to display the document inside a window/box/control on a form. My assumption being that a PDF file would be trying to show one or more A4/Letter size pages which would not be easy to read in a small window.

I'm sure there may well be ActiveX products that can be added into Access to allow displaying PDF's in an 'Image Control'; I've never needed to look for one, but I would expect instructions how to use it to be provided by the software supplier.

I will look into this further and am currently checking AcroPDF.dll
S7
Feb 27 '08 #4
Fred Ho
18
Thanks for the previous suggestion!
I have add a preview button at the subform and insert a OLE1 object at the main form call ProjectDrawingForm.

Private Sub Preview_Click()
OLE1.Class = "Adobe Acrobat 7.0"
OLE1.OLETypeAllowed = acOLELinkedOLE1.SourceDoc = "C:\xnview\" & Form![Text 14].value &".pdf
OLE1.Action = acOLECreateLink
OLE1.SizeMode = acOLESizeZoom
End Sub

(change to following)
Private Sub Preview_Click()
Form_ProjectDrawingForm.OLE1.Class = "Adobe Acrobat 7.0"
Form_ProjectDrawingForm.OLE1.OLETypeAllowed = acOLELinked
Form_ProjectDrawingForm.OLE1.SourceDoc = "G:\AsBuilt\C\C001\1135_0A.pdf"
Form_ProjectDrawingForm.OLE1.Action = acOLECreateLink
Form_ProjectDrawingForm.OLE1.SizeMode = acOLESizeZoom
End Sub

why the OLE1.Action cannot work ?
Besides,for the SourceDoc, such as Form_ProjectDrawingForm.OLE1.SourceDoc = "G:\AsBuilt\C\C001\1135_0A.pdf" the source "G:\AsBuilt\C\C001\1135_0A.pdf"should be extract from the table ProjtectDrawingRecord and inside a field called ImageLink
But need to change as
(original field look like):> file:\\G:\AsBuilt\C\C001\1135_0A.pdf
(so I need to extract the info look like):>G:\AsBuilt\C\C001\1135_0A.pdf
what will be the code look like for such function?
Thanks a lot!
Mar 4 '08 #5
FishVal
2,653 Expert 2GB
As an additional option you may try WebBrowser ActiveX control on your form.
Using its Navigate method smoothly populates it with an external pdf file.
Acrobat ActiveX control usually makes troubles.

Regards,
Fish
Mar 4 '08 #6
Fred Ho
18
I have sucessfully added the OLE bounded object at the main form.
The OLE will display the pdf file when the preview button at the subform is clicked with the following codes:

Private Sub Preview_Click()
Form_ProjectDrawingForm.OLE1.Class = "Adobe Acrobat 7.0"
Form_ProjectDrawingForm.OLE1.OLETypeAllowed = acOLELinked
Form_ProjectDrawingForm.OLE1.SourceDoc = Me!ImageLink.Value
Form_ProjectDrawingForm.OLE1.Action = acOLECreateLink
Form_ProjectDrawingForm.OLE1.SizeMode = acOLESizeZoom
End Sub

I have problem here:
1. what will be the code change if the value Me!ImageLink.Value (the value is in fact the full path of the pdf file e.g. g:\abc\abc.pdf) is empty or the path is wrong or the file is not exists and let the OLE object display back as a blank white?
2. in fact, there is a reset button in the main form, what code I should add so that the OLE object can reset to blank.
Thanks!
Mar 5 '08 #7
sierra7
446 Expert 256MB
Hi

This looks interesting and I must try it when I get time!

If it works as well as it sounds I would be tempted to have an extra PDF file in the system bearing text saying "Document Not Available" and display that file if
Me!ImageLink.Value was Null, thereby avoiding the problem of an empty OLE control.

S7
Mar 6 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: tom | last post by:
Hey All- I've exported a report to Access's "snapshot" format and want to put it on a website for users to view. However, when I click on the link to the snapshot file, I notice that my browser...
2
by: Avalanche | last post by:
Greetings all. I'm building a database (Access 2003) of applicants. Included in this database I would like to include the PDF applications for individuals in the database, accessable from a form...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
6
by: jdph40 | last post by:
We recently had to upgrade the computers in our company. Now our office's website on our company intranet no longer recognizes reports saved in snapshot format. We get an error message that the...
12
by: DGB | last post by:
Hello All, I have been doing quite a bit of research in this group and have not been able to find the answer that I am looking for. Here is my issue. We currently have Adobe Acrobat v5...
0
by: musicloverlch | last post by:
I used to be able to create PDFs, automatically save them to a file, and mail them out to people. This was on Access 97 with Windows NT. We've changed to Windows XP and Access 2003. Doesn't work...
8
by: deko | last post by:
Can anyone point me to VB/VBA code that will control a TWAIN-compliant scanner?
1
by: sklett | last post by:
I'm curious if anyone has encountered this. I'm developing an outlook add-in that needs to display a PDF. I've included the Adobe Reader ActiveX cotnrol and when I re-load the form I get the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.