Record images on a form

martinainscough

Registered User.
Local time
Today, 00:52
Joined
Apr 8, 2004
Messages
18
Hi All

I have been looking at other thread but i havent found anything that is similar to my situation.

I have a stock table of products and i want to display an image of each product based on one that is selected at that time. All the images are in one set folder. I need to find the image based on the product code and adding the extension ".jpg" which i have done. I do not have a path and image name field as i am using a table imported from ODBC. However not all the images are present so i need the database to show the image if it exsists and show a "no image" if it doesn't

Is this possible and how would i go about it

Any help would be appreciated

Thanks

Martin
 
martinainscough said:
Hi All

I have been looking at other thread but i havent found anything that is similar to my situation.

I have a stock table of products and i want to display an image of each product based on one that is selected at that time. All the images are in one set folder. I need to find the image based on the product code and adding the extension ".jpg" which i have done. I do not have a path and image name field as i am using a table imported from ODBC. However not all the images are present so i need the database to show the image if it exsists and show a "no image" if it doesn't

Is this possible and how would i go about it

Any help would be appreciated

Thanks

Martin

You say the images are in one set folder, but you then say you don't have a path. That doesn't make sense. You need to know where the images are.

Anyway following is code I use for a similar situation.
Code:
Private Sub Form_Current()
Dim strFile As String

strFile = CurrDBDir() & "\images\" & Me!txtArtworkID & ".jpg"
If Dir(strFile) = "" Then
    Me!imgPic.Picture = "\\servername\volumename\artwork\images\notavail.jpg"
Else
    Me!imgPic.Picture = strFile
End If

End Sub

In my case, all the images are stored in an images subfolder of the application folder. You would substitute your ProductCode control for my txtArtworkID control. notavail.jpg is a default image that displays a not available message.
 
Brilliant, Works Great

Many Thanks
 

Users who are viewing this thread

Back
Top Bottom