Clickable Link In Textbox

crow

Registered User.
Local time
Today, 14:14
Joined
Jan 10, 2005
Messages
22
I have a database with a field that is actually a web address from information collected in my form. Is it possible to have this textbox clickable to take me to that web site? I do see in the properties where it says is hyperlink but this doesn't make it clickable. Can someone help me?
 
On the double click/Onclick event of the textbox put the following code:

Something like

Code:
Application.FollowHyperlink me.textboxname

Andy
 
Link in Textbox

Thanks a bunch Spacepro. Worked fine!
 
spacepro said:
On the double click/Onclick event of the textbox put the following code:

Something like

Code:
Application.FollowHyperlink me.textboxname

Andy

I am trying to do the same thing but am getting a message when I click on the link in the listbox stating that the database cannot follow the hyperlink.

I am guessing that I need to replace Application with a reference to the browser? (Application.FollowHyperlink me.textboxname)

Thanks!
 
If you are using a listbox try something like :
Code:
Application.FollowHyperlink me.listbox.selected

Andy
 
Sorry, I am having issues.

I have this as my code:

Private Sub List2_Click()
Application.FollowHyperlink Me.List2.Selected
End Sub

(list 2 being the name of the listbox).

When I click on the hyperlink I get a compile error - Argument not optional .

My VBA is not good enough to know what the problem is
 
razorking said:
Sorry, I am having issues.

I have this as my code:

Private Sub List2_Click()
Application.FollowHyperlink Me.List2.Selected
End Sub

(list 2 being the name of the listbox).

When I click on the hyperlink I get a compile error - Argument not optional .

My VBA is not good enough to know what the problem is

Razorking,

Use the following:

Code:
Application.FollowHyperlink Me.List2.Column(0)

If the link is in the first column leave the 0 in brackets otherwise change to 1 if it is the second column in the listbox, 2 for column 3 etc etc.

Don't know why I suggested the previous code, wasn't concentrating.

Let me know how you get on

Andy
 
Still not working for me. Must be a way to do it. It is giving me a - cannot open the specified file error.

The odd thing (seems odd to me anyway) is that when I debug and point on the yellow highlited portion it shows something like this - see attached pic
 

Attachments

  • err.JPG
    err.JPG
    12.7 KB · Views: 493
Last edited:
Razorking,

It's probably due to the fact the the column in the query/table is set to a column which is not the link field.

I have attached an example for your info, I have dimensioned the address for application.followhyperlink variable.

Code:
Dim link as String
link = me.list0.column(1)
Application FollowHyperlink link

In the Table tblLinks:

LinksID AutoNumber PK
Link Text

The link field is column no 1.

Hope this helps

Andy
 

Attachments

Oh, by the way, for anyone interested:

The difference between spacepros example (that worked) and mine (that did not) was that his field data type where the hyperlink text came from was text and mine was data type hyperlink. I changed my field type to text and it now works using the VBA sp provided and clicking it from the listbox.

I find it odd that it will not follow the link from the listbox if the datatype is hyperlink but will if the datatype is text, but what the heck at least I know how to make it work now.
 
Last edited:
Razorking,

Glad you worked it out. Personally I never use the hyperlink data type.

Good Luck with your project.

Andy
 

Users who are viewing this thread

Back
Top Bottom