Hyperlink on a Form

kwvh
3StarLounger
Posts: 308
Joined: 24 Feb 2010, 13:41

Hyperlink on a Form

Post by kwvh »

I am attempting to attach a link to an image (pdf) on a form. And once linked give the user the ability to click on the control and display the pdf file.

I set up a control button for the user to navigate to the pdf, then store the location in a text box control, formatted as a hyperlink. However, clicking on the hyperlink doesn't do what I expected.

Can anyone show me what I am doing wrong?

Thanks in advance for your ideas.

Ken
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78485
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Hyperlink on a Form

Post by HansV »

The contents of a hyperlink field have a special format:

displaytext#address#subaddress

where:

displaytext = the text shown in the text box; if omitted, the address is displayed
address = URL or path+filename
subaddress = name of the location within the web page or file to jump to (for example a bookmark); can be omitted

In your situation, you only need to specify the address surrounded by # characters:

Me.txtPDF_Location = "#" & strFile & "#"
Best wishes,
Hans

kwvh
3StarLounger
Posts: 308
Joined: 24 Feb 2010, 13:41

Re: Hyperlink on a Form

Post by kwvh »

Hans,

Thanks not only for the solution but the explanation of how hyperlink fields work!

You are the best!

BTW - congratulations on MVP

Ken

User avatar
HansV
Administrator
Posts: 78485
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Hyperlink on a Form

Post by HansV »

kwvh wrote:BTW - congratulations on MVP
Thank you, Ken!
Best wishes,
Hans