We have a telephone directory report in Access 2007. We would like to add a link to each staff person's photo. The photos are in a different location on our network, in our K: drive.
On the Access phone report, the text box holds the field StaffName and the text box is named txtStaffName.
Each photo is named with the staff member's name, for example: Brown_Sue.jpg. This name corresponds to the name on the phone list report.
I would like to add a hyperlink or a button (not the actual picture) to the side of each person's name on the report, so that when reading the phone list, users can click on the hyperlink/button to open the photo.jpg file that corresponds to that person. I have searched and read many posts on this forum, but haven't found anything that works. The closest I can get is to open the correct directory on K:. Here is what I have right now that does not work. This is in the On Click event of a button:
Private Sub cmdViewPhoto_Click()
On Error Resume Next
Dim sJPG As String
Dim sJPGPath As String
sJPGPath = "k:\web\prod\hr\staffphotos\files\"
sJPG = Dir$(sJPGPath & [txtStaffName] & ".jpg")
Application.FollowHyperlink sJPG
End Sub
Any clues as to how to get this to work? There has to be a way! Thanks.
On the Access phone report, the text box holds the field StaffName and the text box is named txtStaffName.
Each photo is named with the staff member's name, for example: Brown_Sue.jpg. This name corresponds to the name on the phone list report.
I would like to add a hyperlink or a button (not the actual picture) to the side of each person's name on the report, so that when reading the phone list, users can click on the hyperlink/button to open the photo.jpg file that corresponds to that person. I have searched and read many posts on this forum, but haven't found anything that works. The closest I can get is to open the correct directory on K:. Here is what I have right now that does not work. This is in the On Click event of a button:
Private Sub cmdViewPhoto_Click()
On Error Resume Next
Dim sJPG As String
Dim sJPGPath As String
sJPGPath = "k:\web\prod\hr\staffphotos\files\"
sJPG = Dir$(sJPGPath & [txtStaffName] & ".jpg")
Application.FollowHyperlink sJPG
End Sub
Any clues as to how to get this to work? There has to be a way! Thanks.