Hyperlink problem

  • Follow


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
0
Reply Utf 5/11/2010 9:41:01 AM

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.



"blake7" wrote:

> 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
0
Reply Utf 5/11/2010 10:16:02 AM


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

"Wayne-I-M" wrote:

> 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.
> 
> 
> 
> "blake7" wrote:
> 
> > 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
0
Reply Utf 5/11/2010 10:28:01 AM

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.



"blake7" wrote:

> 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
> 
> "Wayne-I-M" wrote:
> 
> > 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.
> > 
> > 
> > 
> > "blake7" wrote:
> > 
> > > 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
0
Reply Utf 5/11/2010 10:52:01 AM

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" wrote:

> 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.
> 
> 
> 
> "blake7" wrote:
> 
> > 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
> > 
> > "Wayne-I-M" wrote:
> > 
> > > 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.
> > > 
> > > 
> > > 
> > > "blake7" wrote:
> > > 
> > > > 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
0
Reply Utf 5/11/2010 11:26:01 AM

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" wrote:

> 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" wrote:
> 
> > 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.
> > 
> > 
> > 
> > "blake7" wrote:
> > 
> > > 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
> > > 
> > > "Wayne-I-M" wrote:
> > > 
> > > > 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.
> > > > 
> > > > 
> > > > 
> > > > "blake7" wrote:
> > > > 
> > > > > 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
0
Reply Utf 5/11/2010 1:06:01 PM

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" wrote:

> 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" wrote:
> 
> > 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" wrote:
> > 
> > > 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.
> > > 
> > > 
> > > 
> > > "blake7" wrote:
> > > 
> > > > 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
> > > > 
> > > > "Wayne-I-M" wrote:
> > > > 
> > > > > 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.
> > > > > 
> > > > > 
> > > > > 
> > > > > "blake7" wrote:
> > > > > 
> > > > > > 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
0
Reply Utf 5/11/2010 5:16:01 PM

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" <blake7@discussions.microsoft.com> wrote in message 
news:8DA1DFD4-343F-488A-A889-DF8BE91A4CBD@microsoft.com...
> 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" wrote:
>
>> 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" wrote:
>>
>> > 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" wrote:
>> >
>> > > 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.
>> > >
>> > >
>> > >
>> > > "blake7" wrote:
>> > >
>> > > > 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
>> > > >
>> > > > "Wayne-I-M" wrote:
>> > > >
>> > > > > 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.
>> > > > >
>> > > > >
>> > > > >
>> > > > > "blake7" wrote:
>> > > > >
>> > > > > > 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 

0
Reply Mark 5/11/2010 10:26:06 PM

7 Replies
181 Views

(page loaded in 0.554 seconds)


Reply: