Message Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a command button that uses the following command to open the server
where job related pictures are stored in files by job numer. It opens the
file based on the job number in a field on form. I want to have a message
box pop up when there is not a file for the related job number. I'm not sure
how to reference this in code and any help would be appreciated. I'm
currenty getting a Runtime Error 490 with End and Debug options. I would
like something more user friendly.

Private Sub Command58_Click()
Dim strPath As String

strPath = "\\servername\PICS\" & Me.JobNumber & "\"

Application.FollowHyperlink strPath

End Sub

Thanks, Phisaw
 
Try

Private Sub Command58_Click()
Dim strPath As String

strPath = "\\servername\PICS\" & Me.JobNumber & "\"
If Dir(strPath) = "" Then
MsgBox "File doesn't exist"
Else
Application.FollowHyperlink strPath
End If


End Sub
 
It worked! Thank you so much, Ofer.

Ofer said:
Try

Private Sub Command58_Click()
Dim strPath As String

strPath = "\\servername\PICS\" & Me.JobNumber & "\"
If Dir(strPath) = "" Then
MsgBox "File doesn't exist"
Else
Application.FollowHyperlink strPath
End If


End Sub
 
Back
Top