need help to open pdf file through Access 2007

nadeemqureshi

New member
Local time
Today, 22:44
Joined
Apr 2, 2007
Messages
9
I have Access database that have a hyperlink field to the PDF file. For which in the form I put Click button with the below code so that I can select the hyperlink to open up the pdf file which is working fine with Access 2003 .

Now problem is after installing Access 2007 when I click command button I got first MS OFFICE security warning message :

“Opining d:\filetraker2009\nad1.pdf
Some file can contain virus or otherwise be harmful to your computer. It is important to be certain that this file is from a trustworthy source. Would you like to open this file? “


When I press ok it doesn’t open Adobe Acrobat Reader nor linked pdf file.

(my code is as below)

Private Sub Command184_Click()

On Error Resume Next
Dim ctl As Control

If IsNull(FileTarkerHL) = False Then

Set ctl = Me.FileTarkerHL
Application.FollowHyperlink Me.FileTarkerHL
Else

Call MsgBox("Sorry No Image Attached ", vbOKOnly + vbInformation, " FileTracker ")

End If

End Sub
 
Last edited:
You need to set the location as a trusted location.
 
thanks for reply . can you tell me plz how can we do this ? since i am new
 
All macros are enable in access 2007 setting still I have same problem. I am using windows vista and office 2007

Regards

nadeem
 
Your office 2007 is updated with the SP2 package?
 
Firstly, let's get rid of some redundancy in your code:
Code:
Private Sub Command184_Click()
[COLOR=Red][B]' On Error Resume Next[/B][/COLOR]
 
If IsNull(FileTarkerHL) = False Then
    Application.FollowHyperlink Me.FileTarkerHL
Else
    MsgBox "Sorry No Image Attached ", vbOKOnly + vbInformation, "  FileTracker "
    End If
End Sub
Copy and paste this exact code.

Notice the line in red which I have commented out, leave it commented. Without that you wouldn't know what error it may throw up.

Run it and see.
 
Firstly, let's get rid of some redundancy in your code:
Code:
Private Sub Command184_Click()
[COLOR=red][B]' On Error Resume Next[/B][/COLOR]
 
If IsNull(FileTarkerHL) = False Then
    Application.FollowHyperlink Me.FileTarkerHL
Else
    MsgBox "Sorry No Image Attached ", vbOKOnly + vbInformation, "  FileTracker "
    End If
End Sub
Copy and paste this exact code.

Notice the line in red which I have commented out, leave it commented. Without that you wouldn't know what error it may throw up.

Run it and see.


Thanks for your reply after putting codes I got Run-time error 486 "no program is register to open this file" . but Adobe Reader 9 is installed in my pc

regards

nadeem
 
If you double-click the file does it open correctly? It might be an assoc issue.
 
If you double-click the file does it open correctly? It might be an assoc issue.

Actually when I click I got security warning message :

“Opining d:\filetraker2009\nad1.pdf


Some file can contain virus or otherwise be harmful to your computer. It is important to be certain that this file is from a trustworthy source. Would you like to open this file? “


Then when I press ok I got run-time error 486
 
I mentioned, when you double-click the pdf document, not going through code. I mean when you try to open the document manually, does it open in adobe acrobat reader?
 
I mentioned, when you double-click the pdf document, not going through code. I mean when you try to open the document manually, does it open in adobe acrobat reader?

yes it does open when i click file directly from folder.

Note: I would like to mention this problem occours only with pdf extention. other then that all other extentions are opening example (gif, jpg,doc.. etc. )

Also if I change default program to open pdf file through "internet explorer" instead of "Adope Reader 9.3" then its open in internet explorler without any problem

Regards
nadeem
 
Last edited:
Go to command prompt (RUN > type CMD > press ENTER) and type

assoc .pdf

Then press enter. What does it read?
 
Go to command prompt (RUN > type CMD > press ENTER) and type

assoc .pdf

Then press enter. What does it read?


.pdf=AcroExch.Document


This is what I got by entering "assoc.pdf" on dos command

regards
nadeem
 
I am also having same problem. I am having adove acrobat 7 and adobe reader 10 intalled in my PC, operating system windows 7 and microsoft office access 2003. while openning a pdf file thru a command button code there is a similar warning message of same as stated before. when click ok then there is a flash of opening the adobe program (may be) and it close instantly and no files open and no trace. all other type files are opening ecept pdf.
But if I open Adobe Reader program and kept running then try to open the .pdf file, it is opening.
 
I have the very same problem: just changed from Access 2000 to 2007 and when trying to open a pdf from code I get the same message (having Acrobat 9.5). Interesting is that only on one out of the six pc that are sharing the same system. I can't find the reason. In my case it does not help if I open Acrobat manually before; I have the same message. This is the code I'm using:

If Me.Pdf = True Then

Application.FollowHyperlink LinkPath & "\OrderConfirmation\" & Me.OrederConfirmationNr & ".pdf"

Else
...

In case someone could help, it would be great; the problem is extremely annoying.

Peter
 
I am also having a hard time attaching pdf files to forms. I tried Adobe reader activex control, but I keep getting the error 'Object doesn't support this property or method'

Any ideasÉ
 

Users who are viewing this thread

Back
Top Bottom