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

Inserting a hyperlink to a Folder Not a File

Status
Not open for further replies.

DoctorV3774

Programmer
Oct 12, 2004
33
US
I have a function that will return a complete file path with file name to a hyperlink field on my form. What I need is to just return the path to the folder and have that folder displayed in the hyperlink field on my form.

Example instead of storing L:\MyDocs\Documentation\Word1.doc

I need to store L:\MyDocs\Documentation in the form's hyperlink field.

How can I do this easily without asking the customer to delete the file path off of the hyperlink? Thanks
 
How do I combine that with a browse button? My field containing the hyperlink is named TxtHyper. I would like them to click a button that lets them browse to this path, double-click and return the path to the text box Txthyper
 
Here is what I have The problem is it returns a folder but the Hyperlink does not work

Dim FileName As String
Dim strFolderName As String
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to Create a Hyperlink to your Folder?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Warning" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
On Error GoTo err_showSendDialog
If Response = vbYes Then ' User chose Yes.
FileName = BrowseFolder("What Folder you want to select?")

TxtHyper = "" & FileName & "# "
'DoCmd.GoToControl "Text9"
'DoCmd.RunCommand acCmdCopy
'DoCmd.GoToControl "TxtHyper"
'DoCmd.RunCommand acCmdPaste
Combo260.SetFocus
Text9 = ""

Else ' User chose No.
DoCmd.CancelEvent
exit_showSendDialog:
Exit Sub
End If
err_showSendDialog:
If Err.Number = 2501 Then 'User Cancelled DoCmd
Resume exit_showSendDialog
Else 'Add your own error handling routine here
Resume exit_showSendDialog
Resume Next
End If
 
Hi

The only thing of interest here is the function BrowseFolder(), but you do not show the code for it

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top