Hi,
A more generic approach (ie. if you may need to access different doc types):
Private Sub cmdDocLink_Click()
Dim strMyFile As String
Dim ctl As CommandButton
Const cstUNCPath As String = "\\myserver\mypath"
Const cstPathChars As Integer = 39
strMyFile = cstUNCPath & Me.DocumentUNC.Value
If Dir(strMyFile) <> "" Then
If Len(strMyFile) > cstPathChars Then
Set ctl = Me!cmdDocLink
With ctl
.HyperlinkAddress = strMyFile
.Hyperlink.Follow
End With
End If
Else: MsgBox "File Path is Incorrect! Please check and re-enter."
End If
DoCmd.ShowToolbar "Web", acToolbarNo
End Sub
You don't need to use the const containing the server name etc and you can change it to whatever u like.
This code is for a command button which takes the value of a text box on my form and concatenates it with the constant for the server name & path to producce a full UNC path. It can be a web address also.
The last line hides the web toolbar (cos it appears automatically when you click a hyperlink).
HTH,
Burns