Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting in HyperLinks into Access 97 1

Status
Not open for further replies.

dakota81

Technical User
Joined
May 15, 2001
Messages
1,691
Location
US
I can create a table field with the hyperlink data type, and link to the internet that way. However, I'm wondering how I can make a link work from vb code. If I had a string variable holding the web address, "http:\\ or e-mail link, "mailto:foo@foo.com", what is the command or syntax to bring up the link?
 
Dakota,
This is pretty simple. Here is the code...

Function Google()
Access.Application.FollowHyperlink ("End Function

Call the Google function from your form.

The Mailto: command I am not sure about. It might just be:

Function Mailto()
Access.Application.FollowHyperlink (MailTo: "tektips@tektips.com")
End Function
May or may not need quotes on the email address, may need quotes bfeore and after parenthesis. Goodluck.

-Josh ------------------
-JPeters
Got a helpful tip for Access Users? Check out and contribute to 'How to Keep Your Databases from becoming Overwhelming!'
thread181-293590
jpeters@guidemail.com
------------------
 
How would you follow a link, different for each record? Say I have a form holding all employee data. There is an e-mail or web address box. Is there a way to have a command button open the link typed into the text field?
 
First off above my code should be Access.Application.FollowHyperlink ("No semicolon .. I don't know how that got in there. TekTip's forum software is throwing in these semicolons so ignore them in this entire post, please.

zx6r_ryder,
Create a your html field where you store your links. Have this field on your form in a text box of some sort. Create a module... paste this and edit it for your records...

Function GotoLink()
Dim frm As Form
Set frm = Forms!frmMyForm ' replace with your form name
Dim link as TextBox
Set link = frm!txtHyperLink ' replace with your Hyperlink Textbox Name

Access.Application.FollowHyperlink (link)

End Function

Now in your form, create a button and in the OnClick event call the GotoLink function.

Private Sub MyButton_OnClick()
GotoLink
End Sub

This will change the 'link' string everytime you change records on your form.

If you want to play with this, you can use this code as well..

Sub TestLink()
Dim link As String
link = "Access.Application.FollowHyperlink (link)
End Sub

Gives you some ideas and room to play with.

-Josh ------------------
-JPeters
Got a helpful tip for Access Users? Check out and contribute to 'How to Keep Your Databases from becoming Overwhelming!'
thread181-293590
jpeters@guidemail.com
------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top