Hyperlink problem

B

blake7

Hi All, I have the code below on a command button, to insert a hyperlink into
a text box, but it is not working, can you help. Thanks



Private Sub Command107_Click()
Me.Hyperlink1.SetFocus
RunCommand acCmdInsertHyperlink

End Sub
 
W

Wayne-I-M

Is Hyperlink1 an OLE field ?

If not you need to give more details of what the end result is that you're
trying to get.

Also, when you say "not working". Are you getting an error message (like
2046 or 2501, etc)

More details are needed to be able to give a good answer
 
B

blake7

Hi Wayne, Thanks for replying, how do i check to see if it is an OLE and what
does this mean? I do not get an error message when i push the command key but
the fields in the form just flicker a bit ???. Thanks
 
W

Wayne-I-M

Can you say what it is you're trying to do.
I will try and help. There are many experts on this forum, I'm not one of
them, I just write code, but I'll give it a try.
 
B

blake7

Hi Wayne, I have a text [hyperlink field] in which i want to create a link to
a stored pdf file, I want the operator to push the command key to initiate
the insert hyperlink command, this will insert the hyperlink into the text
box, that way anyone viewing the form can click on the link to view the pdf
document.

Hope this explains better what I am trying to do.
 
W

Wayne-I-M

I think this is what you are looking for
http://www.mvps.org/access/api/api0001.htm

As the control holds a hyperlink field you don't need to use inserthyperlink
just the path

--
Wayne
Manchester, England.



blake7 said:
Hi Wayne, I have a text [hyperlink field] in which i want to create a link to
a stored pdf file, I want the operator to push the command key to initiate
the insert hyperlink command, this will insert the hyperlink into the text
box, that way anyone viewing the form can click on the link to view the pdf
document.

Hope this explains better what I am trying to do.

Wayne-I-M said:
Can you say what it is you're trying to do.
I will try and help. There are many experts on this forum, I'm not one of
them, I just write code, but I'll give it a try.
 
B

blake7

Hi Wayne, Thanks again for your help, I checked out the link you gave me and
I have to say it looks a little over the top for what I want to do, the code
below actually works perfect in an access 2003 database that I wrote last
year, cannot understand why it will not work in access 2007? - any other
ideas you can think of?

The pdf files are stored on the hardrive of the PC I just want to create a
hyperlink to them.

Private Sub Command95_Click()
Me.[Hyperlink1].SetFocus
RunCommand acCmdInsertHyperlink

Wayne-I-M said:
I think this is what you are looking for
http://www.mvps.org/access/api/api0001.htm

As the control holds a hyperlink field you don't need to use inserthyperlink
just the path

--
Wayne
Manchester, England.



blake7 said:
Hi Wayne, I have a text [hyperlink field] in which i want to create a link to
a stored pdf file, I want the operator to push the command key to initiate
the insert hyperlink command, this will insert the hyperlink into the text
box, that way anyone viewing the form can click on the link to view the pdf
document.

Hope this explains better what I am trying to do.

Wayne-I-M said:
Can you say what it is you're trying to do.
I will try and help. There are many experts on this forum, I'm not one of
them, I just write code, but I'll give it a try.





--
Wayne
Manchester, England.



:

Hi Wayne, Thanks for replying, how do i check to see if it is an OLE and what
does this mean? I do not get an error message when i push the command key but
the fields in the form just flicker a bit ???. Thanks

:

Is Hyperlink1 an OLE field ?

If not you need to give more details of what the end result is that you're
trying to get.

Also, when you say "not working". Are you getting an error message (like
2046 or 2501, etc)

More details are needed to be able to give a good answer


--
Wayne
Manchester, England.



:

Hi All, I have the code below on a command button, to insert a hyperlink into
a text box, but it is not working, can you help. Thanks



Private Sub Command107_Click()
Me.Hyperlink1.SetFocus
RunCommand acCmdInsertHyperlink

End Sub
 
M

Mark Andrews

Perhaps:
http://support.microsoft.com/kb/897755

or just use the shell api to open the pdf:

Here's an example on calling the code:
Private Sub cmdOpenDirectory_Click()
If (Nz(Me.DocumentDirectory, "") <> "") Then
Call OpenDoc(Me.DocumentDirectory)
Else
MsgBox "You must assign a document directory.", vbOKOnly, "Error"
End If
End Sub



Option Compare Database
Option Explicit

Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Public Function OpenDoc(ByVal DocFile As String) As Long
OpenDoc = ShellExecute(0&, vbNullString, DocFile, vbNullString,
vbNullString, vbNormalFocus)
End Function


HTH,

--
Mark Andrews
RPT Software
http://www.rptsoftware.com
http://www.donationmanagementsoftware.com
blake7 said:
Hi Wayne, Thanks again for your help, I checked out the link you gave me
and
I have to say it looks a little over the top for what I want to do, the
code
below actually works perfect in an access 2003 database that I wrote last
year, cannot understand why it will not work in access 2007? - any other
ideas you can think of?

The pdf files are stored on the hardrive of the PC I just want to create a
hyperlink to them.

Private Sub Command95_Click()
Me.[Hyperlink1].SetFocus
RunCommand acCmdInsertHyperlink

Wayne-I-M said:
I think this is what you are looking for
http://www.mvps.org/access/api/api0001.htm

As the control holds a hyperlink field you don't need to use
inserthyperlink
just the path

--
Wayne
Manchester, England.



blake7 said:
Hi Wayne, I have a text [hyperlink field] in which i want to create a
link to
a stored pdf file, I want the operator to push the command key to
initiate
the insert hyperlink command, this will insert the hyperlink into the
text
box, that way anyone viewing the form can click on the link to view the
pdf
document.

Hope this explains better what I am trying to do.

:

Can you say what it is you're trying to do.
I will try and help. There are many experts on this forum, I'm not
one of
them, I just write code, but I'll give it a try.





--
Wayne
Manchester, England.



:

Hi Wayne, Thanks for replying, how do i check to see if it is an
OLE and what
does this mean? I do not get an error message when i push the
command key but
the fields in the form just flicker a bit ???. Thanks

:

Is Hyperlink1 an OLE field ?

If not you need to give more details of what the end result is
that you're
trying to get.

Also, when you say "not working". Are you getting an error
message (like
2046 or 2501, etc)

More details are needed to be able to give a good answer


--
Wayne
Manchester, England.



:

Hi All, I have the code below on a command button, to insert a
hyperlink into
a text box, but it is not working, can you help. Thanks



Private Sub Command107_Click()
Me.Hyperlink1.SetFocus
RunCommand acCmdInsertHyperlink

End Sub
 

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