What control for a hyperlink? Access2000

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15677
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

What control for a hyperlink? Access2000

Post by ChrisGreaves »

I worked out how to make a text field clickable (the text box is called WebPage and clicking in it uses the text content to launch my browser).
Now I've set up a Hyperlink field in my table and can't work out what sort of control I should place on the user form.
The hyperlink field is going to receive the full path & name of a Word document, the document being the source of my data.

My theory is that I'll load my data fields from text in the document, but maintain a link to the original source so that I can quickly fire up Word and see the original press release.

Of course, I could just use a text box and write the VBA code to execute the file - whatever it is - instead of firing up a web browser.
Here is my web page textbox code:

Code: Select all

Private Sub WEBPAGE_Click()
    If Len(Trim(Me!WEBPAGE)) > 0 Then
        Call KillBrowserJob
        Dim retval As Double
        Dim strDestination As String
        strDestination = Me!WEBPAGE
        retval = Shell("C:\Program Files\Mozilla Firefox\firefox.exe " & strDestination)
    Else
    End If
End Sub
By definition, educating the client is the consultant’s first objective

User avatar
HansV
Administrator
Posts: 78706
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: What control for a hyperlink? Access2000

Post by HansV »

If you place a text box on a form and bind it to a hyperlink field, you don't need to do anything special - the text box will act as a hyperlink automatically. No code needed.
Best wishes,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15677
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: What control for a hyperlink? Access2000

Post by ChrisGreaves »

HansV wrote:If you place a text box on a form and bind it to a hyperlink field,..
Hans, thanks.
I just got around to trying this.
Works perfectly and saves having VBA code that somehow always seems to need to be maintained.
By definition, educating the client is the consultant’s first objective