Results 1 to 6 of 6
  1. #1
    jennifers is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2019
    Posts
    19

    On Click Event to Open Web Page?


    How can I code an on click event to open to a URL, hyperlink, from an Access form button?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    research ms access Application.FollowHyperlink and use that in your click event.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    jennifers is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2019
    Posts
    19
    Thank you, I will

  4. #4
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209
    You can open a Web Page by setting the Hyperlink Address Property of a Control with the web page Address: https://www.msaccesstips.com

    Open the Form in normal view and click on the Control. The web page will open in default browser.

  5. #5
    jennifers is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2019
    Posts
    19
    I ended up using a button I already have on the form and putting this in the on click event:

    Private Sub Command0_Click()
    Dim ctl As CommandButton

    Set ctl = Me!Command0
    With ctl
    .Visible = True
    .HyperlinkAddress = "http://ec2....web address here.com"
    .Hyperlink.Follow
    End With
    End Sub

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Works, but is a bit verbose:
    - if the button wasn't visible, you couldn't click it, so making it visible is of no value
    - since the event applies to the very button you're clicking, Dim'ing a variable and setting it to be that same button is of no value
    You probably got that from a form Load event code sample, which means that stuff is required - in that case.

    Simpler:
    Code:
    Private Sub Command0_Click()
    application.followhyperlink "https://Google.com"
    end sub
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 02-28-2017, 09:33 AM
  2. Replies: 2
    Last Post: 10-09-2016, 05:41 PM
  3. Replies: 13
    Last Post: 09-10-2015, 03:37 PM
  4. Replies: 1
    Last Post: 08-24-2012, 06:50 AM
  5. tab control - firing a page on-click event
    By Chuck55 in forum Programming
    Replies: 7
    Last Post: 05-01-2012, 09:57 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums