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

Opening a web page

Status
Not open for further replies.

ndltx5

Technical User
Jun 6, 2007
26
0
0
US
I'm trying to build an event procedure so that on click it opens say msn.com, whats the code to do this.

Thank you
 
Did you look in the access help menu for "Create a Hyperlink" it has the steps to set one up on a form.
 
Ya I just figured it out.
Thanks
 
An example... I have used this code to open the website stored in the textbox name 'txtWebsite'

Code:
Private Sub cmdOpenWebsite_Click()
On Error GoTo cmdOpenWebsite_Click_Err

Dim strAddress As String

If IsNull(Me.txtWebsite) Then
    MsgBox "No Website address data is present", vbOKOnly, "Missing Data"
Else:
    strAddress = "[URL unfurl="true"]http://"[/URL] & Me.txtWebsite
    Application.FollowHyperlink strAddress, , True
End If

cmdOpenWebsite_Click_Exit:
    Exit Sub

cmdOpenWebsite_Click_Err:
    MsgBox Err.Description, vbCritical, _
    "Error Opening Website"
    Resume cmdOpenWebsite_Click_Exit


End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top