Previous answer was close to right, written incorrectly; there is no "FileExists" class in VBScript; it's a method of the FileSystemObject class.
Private Sub Form_Current()
If Me![ID] <> 0 Then
Dim strPath = "p:\ViewPhotos\Photos\" & Me![ID] & ".jpg"
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
If objFSO.FileExists( strPath ) Then
Me!Image14.Picture = strPath
Label20.Caption = "File: " & strPath
End If
End If
Set objFSO = Nothing
End Sub
If you want to have a default "No picture" image, e.g., nopicture.jpg, that shows whenever a picture cannot be found:
Private Sub Form_Current()
If Me![ID] <> 0 Then
Dim strPath = "p:\ViewPhotos\Photos\" & Me![ID] & ".jpg"
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
If Not objFSO.FileExists( strPath ) Then
strPath = "p\ViewPhotos\Photos\" & "noimage.jpg"
End If
Me!Image14.Picture = strPath
Label20.Caption = "File: " & strPath
End If
Set objFSO = Nothing
End Sub