How do I open a .gif from a subform

T

texasyankee

I need to put a control on a subform (datasheet) that would bring up either a
..gif or PDF which varies based on the value of a field in the row. Appears
that I can put a toggle control and possibly OnClick open the .gif or PDF but
I haven't been able to figure out how using a Macro or Code builder.

Can anyone help me with this? Thanks.
 
T

texasyankee

Thanks for the quck response. I'm really new to Access so please bear with
me. I wasn't sure about the hyperlink address syntax.... so I created a new
form with a command button and used the build next to the Hyperlink address
property and the Insert Hyperlink dialog box to get the address.

I then added the command with this address to an event procedure (my first
one):
Private Sub PDF_Checklist_Click()
DoCmd.FollowHyperlink "Doc%20Checklist.pdf"
End Sub

I'm getting method or data member not found and after reading help, I'm
stiil in the dark. Is my hyperlink address incorrect or is there something
else wrong? Thanks in advance for your help.
 
D

Daniel Pineault

You need to give the complete path of the file. try something more like:

Dim sFilePath as string
sFilePath = "C:\Test\Doc Checklist.pdf" 'change to suit your needs
DoCmd.FollowHyperlink sFilePath

--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
T

texasyankee

I changed the file path as you suggested but it appears to be a different
problem. When I compile, FollowHyperlink in the DoCmd highlights and I get
that Method or data member not found message.
Private Sub Check31_Click()
Dim sFilePath As String
sFilePath = "C:\Documents and Settings\llltr000\Desktop\Parts DB\Doc
Checklist.pdf"
DoCmd.FollowHyperlink sFilePath

Any other suggestions? Thanks for the help by the way.
 
D

Daniel Pineault

My mistake. It is not a DoCmd. but rather an Application. method. You also
have an error writing your sFilePath

Try the following as it works fine for me.

Dim sFilePath As String
sFilePath = "C:\Documents and Settings\llltr000\Desktop\Parts DB\Doc " & _
"Checklist.pdf"
Application.FollowHyperlink sFilePath
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top