Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA - Access (Images & Pictures) - type mismatch :( 1

Status
Not open for further replies.

cutestuff

Technical User
Sep 7, 2006
162
CA
hi,

I am at my wits end on this one.
Problem is, this was working a few weeks ago but when I tried it again, it is giving me a type mismatch error.
Here is my code:

On Error GoTo PictureNotAvailable
Me!ImageFrame.Picture = Me!ImagePath
PictureNotAvailable:
strNoImage = "Z:\Photos\NoImage.gif"
Me.ImageFrame.Picture = strNoImage

Basically, I have a form where a user can select an image to attach to an item and it stores the image path on to a master table.

My problem is the code ALWAYS seems to go straight to the GoTo statement. So it keeps displaying "No Image"
I tried commenting out the Error trap and it works but when I have no path/image assigned to an item, it's giving me a "Type Mismatch" message.

Any ideas? It's driving me crazy!
Help please!
 
I had the same problem once and what i did is like this

Code:
On Error GoTo Err_Eth
    ImageST.Picture = "C:\VPN\Images\" & StyleNo & ".jpg"
    Me.Refresh
 
Err_Eth:
    If ImageST.Picture = "C:\VPN\Images\" & StyleNo & ".jpg" Then
        Exit Sub
    Else
        ImageST.Picture = "C:\VPN\Images\NOIMAGE.jpg"
    End If

hope you get the idea

I will try my best to help others so will others do!!!!!
IGPCS
Brooklyn, NY
 
It worked!!!

Thanks so much!!!

I was going crazy here.

Thanks again!
 
your welcome

I will try my best to help others so will others do!!!!!
IGPCS
Brooklyn, NY
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top