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

How does Application.FollowHyperLink work? 1

Status
Not open for further replies.

Eutychus

Programmer
Nov 14, 2007
61
US
I have an Access 2003 database received from someone else with code behind the OnClick event of a button on a form as follows:
Dim MyString As String
MyString = "\\MySrvrName\MyFolder\" & Mid(cboLastName, 1, 1) & "\" & Forms![frmMyForm]!cboLastName & ", " & Forms![frmMyForm]!cboFirstName.Column(1) & " " & DateofBirth
Application.FollowHyperlink MyString

When the button is clicked, Windows Explorer is activated and finds the folder named, for example, "Public, Joe 1-1-1983", based on values on the form.
I understand that the string MyString is built from the values on the form being added to the string "\\MySrvrName\MyFolder\" but I'm not completely sure how the Application.FollowHyperLink method works to open Windows Explorer and find the folder. Here's what puzzles me the most: (1) how is it determined that Windows Explorer is the application to use? (2) How is the expression "Application." functioning in the code? I think that "Application." refers to the active Microsoft Access application and that "Application" refers to an expression that returns one of the objects in the Applies To list of the HyperLink method. But exactly what function it is performing in this code is a bit vague to me.
I'm not that familiar with the FollowHyperLink method and wonder if someone can point me to where I can get a free (I have a low budget) explanation or if someone can explain it to me.

Thanks much!


 
Application" is not essential, FollowHyperlink will also work. Followhyperlink will open a folder or file with its registered program. For example:

Followhyperlink "C:\Note.txt"

Is likely to open with Notepad, and

Followhyperlink "C:\Note.csv"

May open with several programs, including Notepad and Excel.
 
Thanks Remou! Pardon my ignorance, but I'm still a little unclear on how it is determined that Windows Explorer will be activated. I think I understand that Windows knows the file extensions .txt or .csv or .doc, etc. Thus, it knows what application(s) may open the file. But in this case it is a directory and there is no file extension, so I'm puzzled. Any further insight? This is probably something I should know but my research has not turned up anything so far--I apologize.
Thanks!
 
Windows explorer is the registered program for directories.
 
Also,
You can use the FollowHyperlink method to specify a hyperlink for controls other than labels, image controls, and command buttons, or text boxes bound to Hyperlink fields. It allows you to follow a hyperlink specified in code or passed to the method from an unbound text box. For example, you can prompt a user to type a hyperlink address in a dialog box, and then use the FollowHyperlink method to navigate to that address.
 
Thanks to both Remou and fneily! With a better understanding now, I realize I may be able to use the FollowHyperLink method for another program I'm working on. I appreciate your help!
 
It is wonderfully useful, but can trigger warnings in some cases.

Note that you can also use:

FollowHyperlink "mailto:" & SomeEmailAddress

To invoke the default email program.

I have found that it is much more friendly than hyperlink fields.
 
Again, thank you. The info about invoking the email program might come in handy for yet another application being used by a friend of mine who wants to be able to automate sending emails to certain email addresses. Thanks for the tip, tek Remou!
 
automate sending emails
Have a look to the DoCmd.SendObject method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top