Opening a pdf file from a button command

Sym

Registered User.
Local time
Today, 10:53
Joined
Feb 21, 2015
Messages
40
I would like to open a PDF document using a button control on a form to a file path listed in a field on the form (Me.Link). I am trying to use the followHyperlink code but I keep getting the runtime 490 error.

This is the code im using:
Dim strFilePath As String

strFilePath = Me.Link

Application.FollowHyperlink (strFilePath)

If I put a filepath to one of the pdf documents in the place of (strFilePath) it opens that pdf document fine but not when I declare a filepath based on the one listed on the form.

any ideas on how to fix this?

thanks

thanks
 
Is Me.Link the full file path or just the document name?
 
its the full filepath. infact if I copy whats in that field and paste it where strFilePath is it opens the file no problem but if I leave it as is I get the security pop up and the 490 error. the filepath listed in the warning is exactly what the file path is supposed to be so im not sure why im getting this error
 
also if I copy and paste the filepath in the "link" field where me.link is in the code it works fine too. something wrong with the declaration of the variable I think
 
Could you capture the file path and post it - exactly as it displays?
 
figured it out, some of the records had " before and after the filepath which made duplicate " which is why it wasn't working.
 

Users who are viewing this thread

Back
Top Bottom