Message Box

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
 
G

Guest

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
 
G

Guest

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
 

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