Can you just try this?
Private Sub CommandButton28_Click()
FileName = Me.TBM1Serial
If FileName = vbNullString Then
MsgBox "No Serial number available."
Me.TBM1Serial.SetFocus
Exit Sub
End If
Const strFldrPath As String = "C:\Documents and Settings\carl.walker\My Documents\Reports\"
Dim CurrentFile As String, myPath as string
Dim FileFound As Boolean: FileFound = False
mypath = strFldrPath & cmbDERS & iif(right$(cmbDERS,1)<>"\","\","")
msgbox Dir(mypath, 16) ' this one
if mypath = "" then
msgbox "No such folder":exit sub
endif
CurrentFile = Dir(mypath & "*" & FileName & "*", 0)
If Len(CurrentFile) Then
ActiveWorkbook.FollowHyperlink (mypath & CurrentFile)
FileFound = True
End If
If FileFound = False Then
MsgBox Title:="File Not Found", _
Prompt:="File """ & FileName & """ not found in " & mypath
End If
End Sub
Bookmarks