Image not displaying on form

R

Rpettis31

I have a form that has a hyperlink box and an image box. I would like the
image posted in the hyperlink to display in the image box but I think I must
have an issue with the syntax of the code below. I am getting a runtime 2220
error That it cannot find the file with "#" "#" around the complete file name.

Private Sub Form_Current()

If IsNull(Me.txtPhotos) Then
Me.imgContainer.Picture = "G:\Receiving\Container Data\Container Pics\jami
logo.bmp"
Else
Me.imgContainer.Picture = Me.txtPhotos
End If
 
A

Arvin Meyer MVP

Hyperlinks have "#" signs as delimiters. In Access VBA, the # sign is a date
delimiter. You have a conflict. I suggest that you eliminate the problem by
changing the hyperlink field to a text field and using the hyperlink
property of a textbox like:

Private Sub txtPhotos_DblClick(Cancel As Integer)
Application.FollowHyperlink Me.txtPhotos
End Sub

Now you get txtPhotos working double duty as you wish, with the added
advantages of:

1. Being able to sort (you can't sort hyperlinks)
2. Less bytes (hyperlinks take more space)
3. Lower chance of corruption (OLE field like a hyperlink, corrupt more
often)
 

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