please help to view pdf files in Access forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i am developing a access database which can able to view the pdf files in the
forms.

please suggest how to to this.is there a need to add activeX control?
 
Hi

i m new to this activex linking in access, help me how to implement the pdf
activex n the forms & any coding needed for this,

thanks!
riyaz
 
Hi Riyaz,

While you experiment with the ActiveX stuff, for the time being, I think you
can just use the Shell command to launch the AcrobatReader itself to view the
pdf file you want to view. The following code, triggered by the "On Click"
event of a Command Button on a form, attempts to do that :

Private Sub cmdViewPDF_Click()
On Error GoTo Err_cmdViewPDF_Click

Dim stAppName As String
Dim strPathToAdobe As String
Dim strFileToView As String
Dim Result As Integer

strPathToAdobe = "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32 "
'Note the Space at the end of the above string expression.

With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Select Employee Picture"
.Filters.Add "All Files", "*.*"
.Filters.Add "PDFs", "*.pdf"
.FilterIndex = 2
.AllowMultiSelect = False
.InitialFileName = CurrentProject.Path
Result = .Show
If (Result <> 0) Then
strFileToView = Trim(.SelectedItems.Item(1))
End If
End With

stAppName = strPathToAdobe & strFileToView

Call Shell(stAppName, 1)

Exit_cmdViewPDF_Click:
Exit Sub

Err_cmdViewPDF_Click:
MsgBox Err.Description
Resume Exit_cmdViewPDF_Click

End Sub
 
Oooooooops !!!

This code is part created by the command button wizard and the file dialog
part is copied from Northwind file. Hence, that Title "Select Employee
Picture". Change that to whatever you feel appropriate, like "Select PDF
File".
 
Oooooooops !!!

This code is part created by the command button wizard and the file dialog
part is copied from Northwind file. Hence, that Title "Select Employee
Picture". Change that to whatever you feel appropriate, like "Select PDF
File".

Perhaps you could help me with a question I have been having some
troubles with.

One the file is shown in the control, I would like to save it as text.
Can you tell me how to do this with the control? I cannot seem to get
the focus to the control to be able to save file?

Thank you
 
hi sreedhar

thanks for ur suggestions,
whether the PDF files will open in the same access window or as a separete
window,
i have run ur code , its opening in a separete window is it correct


cheers
riyaz
 
Riyaz,

Do you have a sample of this functioning program to open .PDF files that you
would be willing to share? I am not a programmer, and don't have the means
to do this myself..

Janell
 
I used something very simple and worked perfectly for me, which was to create
a command button on the form and edit the properties and under Hyperlink
Address it has a pull down menu to link it to the pdf or html file. When I
click on the button it opens the file I designated
 
Back
Top