Insert Hyperlink Dialogue Box

  • Thread starter learningonthefly
  • Start date
L

learningonthefly

In a form, I invoke Insert Hyperlink from the main Access Menu. This works
fine. However, all my files that I am browsing to are in a folder that goes
through several layers of a company server:
\\server\folder1\folder2\folder3\folder4. Is there any way I can get the
Dialogue Box to automatically go to this folder. Right now when I click on
'Browse', it opens to a local folder on my harddrive and I manually click
through to the correct folder.
 
T

Tom Wickerath

Yes, as long as your text box is not unbound, the following code should work for you. Watch for
word wrap from the newsreader.

Tom
__________________________________

' Code written by The Gunny
' http://www.qbuilt.com/

Option Compare Database
Option Explicit

Private Const USER_CANC As Long = 2501


Private Sub EditHypLinkBtn_Click()

On Error GoTo ErrHandler

Dim sDefaultDir As String
Dim sOrigText As String

sDefaultDir = "C:\Temp" ' Default directory for the "Edit Hyperlink"
dialog box.

Me!txtHypLink.SetFocus
sOrigText = Me!txtHypLink.Text ' Save value in case user doesn't edit the
hyperlink.

Me!txtHypLink.Text = sDefaultDir
RunCommand acCmdEditHyperlink ' Call the "Insert/Edit Hyperlink" dialog window.

'---------------------------------------------------------------------
' Determine whether user didn't edit the hyperlink.
'---------------------------------------------------------------------

If (Me!txtHypLink.Text = sDefaultDir) Then
Me!txtHypLink.Text = sOrigText ' Replace orig. hyperlink string value.
End If

Exit Sub

ErrHandler:

If (Err.Number = USER_CANC) Then ' User cancelled action.
Resume Next
Else
MsgBox "Error in EditHypLinkBtn_Click( ) in " & vbCrLf & Me.Name & " form." & vbCrLf &
vbCrLf & _
"Error #" & Err.Number & vbCrLf & Err.Description
End If

End Sub ' EditHypLinkBtn_Click( )

____________________________________________________________



In a form, I invoke Insert Hyperlink from the main Access Menu. This works
fine. However, all my files that I am browsing to are in a folder that goes
through several layers of a company server:
\\server\folder1\folder2\folder3\folder4. Is there any way I can get the
Dialogue Box to automatically go to this folder. Right now when I click on
'Browse', it opens to a local folder on my harddrive and I manually click
through to the correct folder.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top