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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run a hyperlink automatically

Status
Not open for further replies.

pmo

Technical User
Jan 15, 2001
76
AU
I am trying to open a web site without the user having to click on the link. Is this possible?

My intention is to run a macro that makes a couple of tables via "make table queries" then open into a website. The user is only to press the button once to run all of this?

Thanks in anticipation
Wayne
 
Hi

If there is a hyperlink field containing the URL, you can use:
hyperlinkField.Follow

to run it.

John
 
John,
My ability with code is almost non existant hence I was trying to run it through a macro. Can you be more specific as to how I would use your suggestion.

Wayne
 
Wayne

I haven't found a way to execute a hyperlink from a macro directly. The FollowHyperlink requies a basic knowledge of VBA programming.
A workaround however is to create a new module and paste the following code into it then save it as modWeb. (it is known to work with Access 97, 2000 and 2002):

Public Function GoToWebsite(strURL As String)
Application.FollowHyperlink strURL
End Function

Once this is done you can use the RunCode action of a macro to execute this. For example:

Action: RunCode
Function Name:
GoToWebsite("
When this is run it will open the default web browser at the Tek-Tips homepage. Replace this with your preferred website.

John
 
Take out the semi colon after the second double quote and before the close bracket that the submission process has put in.
 
Thanks John I will give it a go.

Wayne
 
pmo, copy and paste the code from jrbarnett

Public Function GoToWebsite(strURL As String)
Application.FollowHyperlink strURL
End Function

and then, while you are in the design view of the form you are working on, press Alt-F11 to open the code editor. In the upper right hand of the window, double click on module.

Click in the toolbar insert and then click on module. You will see a blank page with Option Compare Database at the top. Paste in the code; click on debug/compile to see that it is running okay and then use it as jrbarnett tells you!

Judge Hopkins

"...like hunting skunks underwater...."
John Steinbeck, The Grapes of Wrath
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top